命令行调试构建项目架构 i386 的未定义符号

command line debug build project Undefined symbols for architecture i386

运行 xcodebuild -target szapp returns:

CONFIGURATION_BUILD_DIR=$/Users/szmall/Documents/new12/trunk/head/ShiZu -configuration Debug build -sdk iphonesimulator9.2 ONLY_ACTIVE_ARCH=NO VALID_ARCHS='arm64 armv7s armv7 i386'
build my project have this error:
Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_QQApiAudioObject", referenced from:
      objc-class-ref in libSocialQQ.a(UMSocialQQHandler.o)
  "_OBJC_CLASS_$_QQApiImageObject", referenced from:
      objc-class-ref in libSocialQQ.a(UMSocialQQHandler.o)
  "_OBJC_CLASS_$_QQApiInterface", referenced from:
      objc-class-ref in libSocialQQ.a(UMSocialQQHandler.o)
  "_OBJC_CLASS_$_QQApiNewsObject", referenced from:
      objc-class-ref in libSocialQQ.a(UMSocialQQHandler.o)
  "_OBJC_CLASS_$_QQApiTextObject", referenced from:
      objc-class-ref in libSocialQQ.a(UMSocialQQHandler.o)
  "_OBJC_CLASS_$_QQApiVideoObject", referenced from:
      objc-class-ref in libSocialQQ.a(UMSocialQQHandler.o)
  "_OBJC_CLASS_$_SendMessageToQQReq", referenced from:
      objc-class-ref in libSocialQQ.a(UMSocialQQHandler.o)
  "_OBJC_CLASS_$_TencentOAuth", referenced from:
      objc-class-ref in libSocialQQ.a(UMSocialQQHandler.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

但 libSocialQQ.a 存在于 Link Binary With Libraries 上。

并且使用xcode运行我的项目可以构建成功。请帮帮我,谢谢!

从 Target 的 Build Settings -> Architectures -> Valid Architectures 中删除 i386,无需指定。但是,如果您的库不包含 i386 的代码 - 您在较旧的模拟器上尝试 运行 时会遇到问题。

顺便说一句,您可以使用命令 lipo -info libSocialQQ.a.

检查支持的架构