最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

[已解决]iOS项目链接失败: Undefined symbols for architecture i386 _OBJC_CLASS_$_QQApiInterface referenced from objc-class-ref in AppDelegate.o

iOS crifan 2125浏览 0评论

拿到一个iOS的ObjC项目,目标选择的是iOS 模拟器,

去编译出错:

Ld /Users/crifan/Library/Developer/Xcode/DerivedData/skodarse-gkfkkynbecrtfsfvwgbrdljcuonh/Build/Products/Debug-iphonesimulator/skodarse.app/skodarse normal i386
    cd /Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0
    export IPHONEOS_DEPLOYMENT_TARGET=7.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk -L/Users/crifan/Library/Developer/Xcode/DerivedData/skodarse-gkfkkynbecrtfsfvwgbrdljcuonh/Build/Products/Debug-iphonesimulator -L/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/VoiceConverter -L/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/WeChat -L/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/Baidu_Voice_Combine_SDK_iOS/libBDVoiceRecognitionClient -L/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/jpushlib -L/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/ShareSDK/Support/PlatformSDK/WeChatSDK -F/Users/crifan/Library/Developer/Xcode/DerivedData/skodarse-gkfkkynbecrtfsfvwgbrdljcuonh/Build/Products/Debug-iphonesimulator -F/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs -F/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/ShareSDK -F/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/ShareSDK/Support/Optional -F/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/ShareSDK/Support/PlatformSDK/QQSDK -F/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/ShareSDK/Support/Required -filelist /Users/crifan/Library/Developer/Xcode/DerivedData/skodarse-gkfkkynbecrtfsfvwgbrdljcuonh/Build/Intermediates/skodarse.build/Debug-iphonesimulator/skodarse.build/Objects-normal/i386/skodarse.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=7.0 -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -ObjC -fobjc-arc -fobjc-link-runtime -stdlib=libc++ -framework MessageUI -lsqlite3 -framework JavaScriptCore -lstdc++ -lz -licucore -lz.1.2.5 -framework AudioToolbox -framework CoreText -framework OpenGLES -framework GLKit -framework AddressBook -lBDVoiceRecognitionClient -framework CoreLocation -framework MOBFoundation -framework MobileCoreServices -framework CFNetwork /Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/jpushlib/jpush-ios-2.1.8.a -framework CoreAudio -framework AVFoundation -framework CoreTelephony -lWeChatSDK -framework ShareSDK -lc++.1 -lsqlite3.0 -lWeChatSDK -framework SystemConfiguration -framework ShareSDKUI -framework QuartzCore -framework Foundation -lopencore-amrwb -framework ShareSDKConnector -framework CoreGraphics -framework TencentOpenAPI -lopencore-amrnb -framework ShareSDKExtension -framework UIKit -framework Security -Xlinker -dependency_info -Xlinker /Users/crifan/Library/Developer/Xcode/DerivedData/skodarse-gkfkkynbecrtfsfvwgbrdljcuonh/Build/Intermediates/skodarse.build/Debug-iphonesimulator/skodarse.build/Objects-normal/i386/skodarse_dependency_info.dat -o /Users/crifan/Library/Developer/Xcode/DerivedData/skodarse-gkfkkynbecrtfsfvwgbrdljcuonh/Build/Products/Debug-iphonesimulator/skodarse.app/skodarse
ld: warning: ignoring file /Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/ShareSDK/Support/PlatformSDK/QQSDK/TencentOpenAPI.framework/TencentOpenAPI, missing required architecture i386 in file /Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/ShareSDK/Support/PlatformSDK/QQSDK/TencentOpenAPI.framework/TencentOpenAPI (3 slices)
Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_QQApiInterface", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_TencentOAuth", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

搜:

"_OBJC_CLASS_$_QQApiInterface", referenced from:

参考:

iOS7.1 编译报错 解决方案 体会 – topbar的专栏 – 博客频道 – CSDN.NET

TencentOpenAPI 的IOS sdk不支持64位吗? – CocoaChina移动版

IOS编译报错:objc-class-ref in AppDelegate.o之解决方案 Xcode7 – MokeyChan – 博客园

模拟器中运行报错Undefined symbols for architecture i386_U盟友盟社会化分享论坛_【友盟+】开发者社区

目前是:

$(ARCHS_STANDARD)

改为:

$(ARCHS_STANDARD_32_BIT)

输入完毕后,结果没有显示出具体的值:

只有美元符号

-》估计Xcode都已经废弃了$(ARCHS_STANDARD_32_BIT)

-》去改为:

armv7 armv7s

再把Valid Architectures从:

armv7 armv7s arm64

改为:

armv7 armv7s

Build Active Architectures Only

的debug从Yes改为No

重新clean后再编译试试

结果还是出错。

把iOS模拟器,换成真机

再去编译试试

结果提示:

Failed to code sign "skodarse".
No valid signing identities (i.e. certificate and private key pair) matching the team ID “434288V6VF” were found.
Xcode can attempt to fix this issue. This will reset your code signing and provisioning settings to recommended values and resolve issues with signing identities and provisioning profiles.

点击Fix Issue

然后又点击了两次Fix Issue,就可以正常继续编译了。

结果出现类似的错误:

Ld /Users/crifan/Library/Developer/Xcode/DerivedData/skodarse-gkfkkynbecrtfsfvwgbrdljcuonh/Build/Intermediates/skodarse.build/Debug-iphoneos/skodarse.build/Objects-normal/armv7s/skodarse normal armv7s
    cd /Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0
    export IPHONEOS_DEPLOYMENT_TARGET=7.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk -L/Users/crifan/Library/Developer/Xcode/DerivedData/skodarse-gkfkkynbecrtfsfvwgbrdljcuonh/Build/Products/Debug-iphoneos -L/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/VoiceConverter -L/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/WeChat -L/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/Baidu_Voice_Combine_SDK_iOS/libBDVoiceRecognitionClient -L/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/jpushlib -L/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/ShareSDK/Support/PlatformSDK/WeChatSDK -F/Users/crifan/Library/Developer/Xcode/DerivedData/skodarse-gkfkkynbecrtfsfvwgbrdljcuonh/Build/Products/Debug-iphoneos -F/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs -F/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/ShareSDK -F/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/ShareSDK/Support/Optional -F/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/ShareSDK/Support/PlatformSDK/QQSDK -F/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/ShareSDK/Support/Required -filelist /Users/crifan/Library/Developer/Xcode/DerivedData/skodarse-gkfkkynbecrtfsfvwgbrdljcuonh/Build/Intermediates/skodarse.build/Debug-iphoneos/skodarse.build/Objects-normal/armv7s/skodarse.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=7.0 -dead_strip -Xlinker -no_deduplicate -ObjC -fobjc-arc -fobjc-link-runtime -stdlib=libc++ -framework MessageUI -lsqlite3 -framework JavaScriptCore -lstdc++ -lz -licucore -lz.1.2.5 -framework AudioToolbox -framework CoreText -framework OpenGLES -framework GLKit -framework AddressBook -lBDVoiceRecognitionClient -framework CoreLocation -framework MOBFoundation -framework MobileCoreServices -framework CFNetwork /Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/jpushlib/jpush-ios-2.1.8.a -framework CoreAudio -framework AVFoundation -framework CoreTelephony -lWeChatSDK -framework ShareSDK -lc++.1 -lsqlite3.0 -lWeChatSDK -framework SystemConfiguration -framework ShareSDKUI -framework QuartzCore -framework Foundation -lopencore-amrwb -framework ShareSDKConnector -framework CoreGraphics -framework TencentOpenAPI -lopencore-amrnb -framework ShareSDKExtension -framework UIKit -framework Security -Xlinker -dependency_info -Xlinker /Users/crifan/Library/Developer/Xcode/DerivedData/skodarse-gkfkkynbecrtfsfvwgbrdljcuonh/Build/Intermediates/skodarse.build/Debug-iphoneos/skodarse.build/Objects-normal/armv7s/skodarse_dependency_info.dat -o /Users/crifan/Library/Developer/Xcode/DerivedData/skodarse-gkfkkynbecrtfsfvwgbrdljcuonh/Build/Intermediates/skodarse.build/Debug-iphoneos/skodarse.build/Objects-normal/armv7s/skodarse
ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/ShareSDK/Support/PlatformSDK/QQSDK/TencentOpenAPI.framework/TencentOpenAPI file ‘/Users/crifan/dev/dev_root/daryun/Projects/RSE/sourcecode/代码0819/rse1.0/rse/Thiredlibs/ShareSDK/Support/PlatformSDK/QQSDK/TencentOpenAPI.framework/TencentOpenAPI’ for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

搜:

ld: file is universal (3 slices) but does not contain a(n) armv7s slice TencentOpenAPI.framework/TencentOpenAPI for architecture armv7s

ld: file is universal (3 slices) but does not contain a(n) armv7s slice  TencentOpenAPI for architecture armv7s

objective c – File is universal (three slices), but it does not contain a(n) ARMv7-s slice error for static libraries on iOS, anyway to bypass? – Stack Overflow

xcode – iOS – file does not contain an armv7s slice – Stack Overflow

cordova – new ios6 architecture error: file is universal (3 slices) but does not contain a(n) arm7vs slice – Stack Overflow

ios – file is universal (3 slices) but does not contain a(n) armv7s slice – Stack Overflow

Xcode 4.5 and ‘file is universal (2 slices) but does not contain a(n) armv7s slice’ – Code Ninja

算了,估计是之前的修改,取消了对雨arm64的支持,导致不支持了我的(估计是arm64的)iPhone 6了。

去改回之前的配置吧:

然后终于成功编译和运行了:

[总结]

此处的:

 Undefined symbols for architecture i386: "_OBJC_CLASS_$_QQApiInterface", referenced from: objc-class-ref in AppDelegate.o

的原因是:

此处iOS项目用到的一些第三方的库,比如QQ的一些库,不支持模拟器

所以提示对于i386的模拟器,无法通过链接。

解决办法是:

不要用模拟器,而改用真机,比如此处的iPhone 6,然后Xcode就可以正常编译,链接,运行了。

转载请注明:在路上 » [已解决]iOS项目链接失败: Undefined symbols for architecture i386 _OBJC_CLASS_$_QQApiInterface referenced from objc-class-ref in AppDelegate.o

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
62 queries in 0.115 seconds, using 18.83MB memory