iOS编译失败ld: symbol(s) not found for architecture x86_64错误

xcode环境:7.3.1
系统版本:10.11.6

项目中通过cocoapods添加下面几个库:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

target ‘Zhuoyue’ do
pod 'AFNetworking'
pod 'MOBFoundation_IDFA'
pod 'SMSSDK'
pod 'SSKeychain'
pod 'IQKeyboardManager'

end

安装pod时,实际安装的库版本如下:

Using AFNetworking (3.1.0)
Using IQKeyboardManager (4.0.5)
Using MOBFoundation_IDFA (2.0.10)
Using SMSSDK (2.0.5)
Using SSKeychain (1.4.1)

然而编辑时报错:


Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_AFHTTPSessionManager", referenced from:
      _OBJC_CLASS_$_HttpClient in HttpClient.o
  "_OBJC_CLASS_$_AFSecurityPolicy", referenced from:
      objc-class-ref in HttpClient.o
  "_OBJC_CLASS_$_SSKeychain", referenced from:
      objc-class-ref in UserManager.o
  "_OBJC_METACLASS_$_AFHTTPSessionManager", referenced from:
      _OBJC_METACLASS_$_HttpClient in HttpClient.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

奇怪的是,真机运行时没有问题,但是模拟器编译时就报错了,请问这个问题该如何解决?

阅读 14.3k
1 个回答

问题已得到解决,解决方法如下:
~/Library/Developer/Xcode/DerivedData 关掉xcode,删掉DerivedData这个文件夹里的全部东西 然后重新打开项目clean>build

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏