美文网首页
Swift 因为UI_USER_INTERFACE_IDIOM(

Swift 因为UI_USER_INTERFACE_IDIOM(

作者: iOS_July | 来源:发表于2022-04-29 14:08 被阅读0次
    Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
    Stack dump:
    0.  Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/xxx/Library/Developer/Xcode/DerivedData/iosapp-gnqfhkicbkgcmtacvhhuiwwskazj/Build/Intermediates.noindex/ArchiveIntermediates/iosapp/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/ZLPhotoBrowser.build/Objects-normal/arm64/ZLThumbnailViewController.bc -embed-bitcode -target arm64-apple-ios10.0 -Xllvm -aarch64-use-tbi -O -disable-llvm-optzns -module-name ZLPhotoBrowser -o /Users/xxx/Library/Developer/Xcode/DerivedData/iosapp-gnqfhkicbkgcmtacvhhuiwwskazj/Build/Intermediates.noindex/ArchiveIntermediates/iosapp/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/ZLPhotoBrowser.build/Objects-normal/arm64/ZLThumbnailViewController.o
    1.  Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)
    2.  Compiling with the current language version
    3.  Running pass 'Function Pass Manager' on module '/Users/xxx/Library/Developer/Xcode/DerivedData/iosapp-gnqfhkicbkgcmtacvhhuiwwskazj/Build/Intermediates.noindex/ArchiveIntermediates/iosapp/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/ZLPhotoBrowser.build/Objects-normal/arm64/ZLThumbnailViewController.bc'.
    4.  Running pass 'ObjC ARC contraction' on function '@UI_USER_INTERFACE_IDIOM'
    

    起始:
    很莫名其妙,当时心里一惊,难道做了那么久,最后做了一个无法打包的app......
    后来终于发现了问题,UI_USER_INTERFACE_IDIOM (),我用来判断了设备是否是iPad......

    解决:
    在项目里跳到UI_USER_INTERFACE_IDIOM里看到了如下

    /* The UI_USER_INTERFACE_IDIOM() function is provided for use when deploying to a 
    version of the iOS less than 3.2. If the earliest version of iPhone/iOS that you will be 
    deploying for is 3.2 or greater, you may use -[UIDevice userInterfaceIdiom] directly.
     */
    @available(iOS, introduced: 2.0, deprecated: 13.0, message: "Use -[UIDevice userInterfaceIdiom] directly.")
    public func UI_USER_INTERFACE_IDIOM() -> UIUserInterfaceIdiom
    

    所以最后 将UI_USER_INTERFACE_IDIOMUIDevice.current.userInterfaceIdiom替换,再次打包,就成功了。

    相关文章

      网友评论

          本文标题:Swift 因为UI_USER_INTERFACE_IDIOM(

          本文链接:https://www.haomeiwen.com/subject/yovfyrtx.html