更新到Swift 4.2之后的Xcode构建错误-体系结构arm64的未定义符号

时间:2018-09-30 15:47:57

标签: ios swift xcode cocoapods linker-errors

我正在尝试构建自去年6月以来从未涉及过的Xcode iOS项目。我知道软件包进行了一些更新,而Swift 4.2进行了一些更新,但是出现了很多错误。

首先,我得到了一个库,未加载类似于this的错误,但是是RestKit。我将其添加到了pods文件中,并将其包含在Link Binary with Libraries中。然后我收到了此错误消息。

Ld /Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/BuddyV2.app/BuddyV2 normal arm64 (in target: BuddyV2)
    cd /Users/arkwl/Desktop/Workstation/OfficeBuddy/BuddyV2
    export IPHONEOS_DEPLOYMENT_TARGET=11.3
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk -L/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/FirebaseAuth -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/FirebaseCore -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/FirebaseDatabase -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/FirebaseStorage -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/GTMSessionFetcher -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/GoogleUtilities -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/ISO8601DateFormatterValueTransformer -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/JSQMessagesViewController -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/JSQSystemSoundPlayer -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/RKValueTransformers -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/RestKit -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/SOCKit -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/SwiftInstagram -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/SwiftyJSON -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/TransitionKit -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/leveldb-library -F/Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/nanopb -F/Users/arkwl/Desktop/Workstation/OfficeBuddy/BuddyV2/Pods/FirebaseAnalytics/Frameworks -F/Users/arkwl/Desktop/Workstation/OfficeBuddy/BuddyV2/Pods/FirebaseInstanceID/Frameworks -F/Users/arkwl/Desktop/Workstation/OfficeBuddy/BuddyV2/Pods/GoogleAppMeasurement/Frameworks -F/Users/arkwl/Desktop/Workstation/OfficeBuddy/BuddyV2/Carthage/Build/iOS -filelist /Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Intermediates.noindex/BuddyV2.build/Debug-iphoneos/BuddyV2.build/Objects-normal/arm64/BuddyV2.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=11.3 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Intermediates.noindex/BuddyV2.build/Debug-iphoneos/BuddyV2.build/Objects-normal/arm64/BuddyV2_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fembed-bitcode-marker -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -add_ast_path -Xlinker /Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Intermediates.noindex/BuddyV2.build/Debug-iphoneos/BuddyV2.build/Objects-normal/arm64/BuddyV2.swiftmodule -ObjC -lc++ -licucore -lsqlite3 -lz -framework CFNetwork -framework FIRAnalyticsConnector -framework FirebaseAnalytics -framework FirebaseAuth -framework FirebaseCore -framework FirebaseCoreDiagnostics -framework FirebaseDatabase -framework FirebaseInstanceID -framework FirebaseStorage -framework Foundation -framework GTMSessionFetcher -framework GoogleAppMeasurement -framework GoogleUtilities -framework ISO8601DateFormatterValueTransformer -framework JSQMessagesViewController -framework JSQSystemSoundPlayer -framework MobileCoreServices -framework RKValueTransformers -framework RestKit -framework SOCKit -framework Security -framework StoreKit -framework SwiftInstagram -framework SwiftyJSON -framework SystemConfiguration -framework TransitionKit -framework leveldb -framework nanopb -framework RestKit -framework LanguageTranslatorV2 -framework SpeechToTextV1 -framework TextToSpeechV1 -framework AssistantV1 -framework PersonalityInsightsV3 -framework Starscream -framework ConversationV1 -framework VisualRecognitionV3 -framework NaturalLanguageUnderstandingV1 -framework DiscoveryV1 -framework ToneAnalyzerV3 -framework NaturalLanguageClassifierV1 -framework Pods_BuddyV2 -Xlinker -dependency_info -Xlinker /Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Intermediates.noindex/BuddyV2.build/Debug-iphoneos/BuddyV2.build/Objects-normal/arm64/BuddyV2_dependency_info.dat -o /Users/arkwl/Library/Developer/Xcode/DerivedData/BuddyV2-gubyodomquayvxabpgpfpalrnftx/Build/Products/Debug-iphoneos/BuddyV2.app/BuddyV2

Undefined symbols for architecture arm64:
  "type metadata for RestKit.JSON", referenced from:
      type metadata accessor for Swift._HashableTypedNativeDictionaryStorage<Swift.String, RestKit.JSON> in SupportViewController.o
      type metadata accessor for (Swift.String, RestKit.JSON) in SupportViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

我试图查看SupportViewController.swift以查看是否有可能导致它的东西,但没有找到任何东西。另外,我也不知道如何使用-v来查看调用。是什么原因造成的?该项目之前运行良好,我认为更新可能会弄乱一些事情。

以下是控制器的要旨:https://gist.github.com/arkwl/8bcf492cef2e8408852d1be98172b7b7

我还尝试过将链接器标志添加到pods项目中,在这里提到:https://stackoverflow.com/a/26903572/4672331

是的,我确实尝试过重建。

1 个答案:

答案 0 :(得分:1)

嗯。这里有几种可能,但最有可能的似乎是在代码之前没有构建RestKit框架。在使用它的任何源代码中,您肯定应该有一个import RestKit语句(如注释中所建议)。但是对我来说,这个错误是说它找不到框架。因此,我将回顾构建RestKit的日志部分,并确保这样做没有错误。

通常来说,除非框架doco表示要这样做,否则您无需修改​​任何链接器标志。在框架搜索路径中没有正确的框架路径是此类问题的更常见来源。

此外,您还提到了加载框架图像的早期问题。通常在应用程序启动期间实际尝试加载框架时会出现此错误。最常见的原因是已将框架链接进去进行编译,但没有将其复制到应用程序捆绑包中进行部署。

因此,我建议您看一下RestKit框架的构建位置以及构建方式(Carthage或CocoaPods或其他东西),在框架中指定的路径搜索路径设置,以及如何将框架添加到应用程序中。 / p>