未定义的体系结构符号 x86_64 - ld:找不到体系结构的符号 x86_64

Undefined symbols for architecture x86_64 - ld: symbol(s) not found for architecture x86_64

我无法解决以下错误。我用过椰子 对于外部 libs/frameworks.

Ld /Users/MyAppapp/Library/Developer/Xcode/DerivedData/MyApp-ceyvfirzookxqtdglefjjtyixokw/Build/Products/Debug-iphonesimulator/MyApp.app/MyApp normal x86_64
    cd /Users/MyAppapp/Documents/MyApp-ios
    export IPHONEOS_DEPLOYMENT_TARGET=7.0
    export PATH="/Applications/Xcode 2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode 2.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode\ 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode\ 2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk -L/Users/MyAppapp/Library/Developer/Xcode/DerivedData/MyApp-ceyvfirzookxqtdglefjjtyixokw/Build/Products/Debug-iphonesimulator -L/Users/MyAppapp/Documents/MyApp-ios/Pods/Realm/core -F/Users/MyAppapp/Library/Developer/Xcode/DerivedData/MyApp-ceyvfirzookxqtdglefjjtyixokw/Build/Products/Debug-iphonesimulator -F/Users/MyAppapp/Documents/MyApp-ios/Pods/Crashlytics -F/Users/MyAppapp/Documents/MyApp-ios/Pods/Digits -F/Users/MyAppapp/Documents/MyApp-ios/Pods/Fabric -F/Users/MyAppapp/Documents/MyApp-ios/Pods/TwitterCore -F/Users/MyAppapp/Documents/MyApp-ios/Pods/TwitterKit -F/Users/MyAppapp/Documents/MyApp-ios -F/Users/MyAppapp/Documents/MyApp-ios/MyApp/Frameworks -F/Users/MyAppapp/Documents/MyApp-ios/MyApp/Frameworks/FacebookSDK -filelist /Users/MyAppapp/Library/Developer/Xcode/DerivedData/MyApp-ceyvfirzookxqtdglefjjtyixokw/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/MyApp.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=7.0 -Xlinker -objc_abi_version -Xlinker 2 -ObjC -ObjC -lBolts -lDiskcached -lFBSDKCoreKit -lFBSDKLoginKit -lFBSDKShareKit -lImageLoader -lMBProgressHUD -lRealm -lc++ -lrealm-ios -lz -framework Accounts -framework AddressBook -framework CoreData -framework CoreGraphics -framework CoreText -framework Crashlytics -framework DigitsKit -framework Fabric -framework Foundation -framework QuartzCore -framework Security -framework Social -framework SystemConfiguration -framework TwitterCore -framework TwitterKit -framework UIKit -weak_framework Accounts -weak_framework AudioToolbox -weak_framework CoreGraphics -weak_framework CoreLocation -weak_framework Foundation -weak_framework QuartzCore -weak_framework Security -weak_framework Social -weak_framework UIKit -fobjc-arc -fobjc-link-runtime /Users/MyAppapp/Library/Developer/Xcode/DerivedData/MyApp-ceyvfirzookxqtdglefjjtyixokw/Build/Products/Debug-iphonesimulator/libMBProgressHUD.a -framework SystemConfiguration -framework QuartzCore -framework OpenGLES -lz -licucore -lc++ -framework ImageIO -framework GLKit -framework CoreText -framework CoreLocation -framework CoreData -framework AVFoundation -framework CoreGraphics -framework UIKit -framework Foundation -lPods -Xlinker -dependency_info -Xlinker /Users/MyAppapp/Library/Developer/Xcode/DerivedData/MyApp-ceyvfirzookxqtdglefjjtyixokw/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/MyApp_dependency_info.dat -o /Users/MyAppapp/Library/Developer/Xcode/DerivedData/MyApp-ceyvfirzookxqtdglefjjtyixokw/Build/Products/Debug-iphonesimulator/MyApp.app/MyApp

ld: warning: directory not found for option '-F/Users/MyAppapp/Documents/MyApp-ios/MyApp/Frameworks'
ld: warning: directory not found for option '-F/Users/MyAppapp/Documents/MyApp-ios/MyApp/Frameworks/FacebookSDK'
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_TWTRAPIResponseValidator", referenced from:
      objc-class-ref in DigitsKit(DGTNetworkingHelper.o)
  "_OBJC_CLASS_$_TWTRGuestSessionRefreshStrategy", referenced from:
      objc-class-ref in DigitsKit(Digits.o)
  "_OBJC_CLASS_$_TWTRNetworkingPipeline", referenced from:
      objc-class-ref in DigitsKit(DGTNetworkingHelper.o)
  "_OBJC_CLASS_$_TWTRSessionStore", referenced from:
      objc-class-ref in DigitsKit(Digits.o)
  "_OBJC_CLASS_$_TWTRURLSessionDelegate", referenced from:
      objc-class-ref in DigitsKit(DGTNetworkingHelper.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

搜索并尝试了许多解决方案,例如 - 链接器错误、验证构建设置或项目目录中缺少框架、更改构建设置中的有效架构、清理派生数据,但无法解决问题。

在某些 post 中,我看到缺少 #inclue#import,但在下面的错误中我没有找到。任何建议。

您缺少TwitterCore library

我是如何找到这个的:

  1. 取一个缺失的符号 (_OBJC_CLASS_$_TWTRSessionStore)。
  2. 在 Google 中搜索 TWTRSessionStore
  3. 点击上方的 cocoapod 网站。

终于解决了。

在我的 Podfile 中,Digits 框架旁边没有指定版本号。我对其进行了修改并保留了与 TwitterCore 相同的编号(即 1.9.0)并保存了它。

比,运行又是pod install。 (这次它从数字框架中获取了一些缺失的数据)

希望对您有所帮助。