building for iOS Simulator, but linking in object file built for iOS,……or architecture arm64

今天在准备打包上架,用模拟器Release模式运行程序,报了一个错:

building for iOS Simulator, but linking in object file built for iOS, file '/Users/……/Pods/AlipaySDK-iOS/AlipaySDK.framework/AlipaySDK' for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

building for iOS Simulator, but linking in object file built for iOS,……or architecture arm64_第1张图片

 

(注:模拟器debug运行或者直接打包不会报这个错)

原来是升级Xcode12之后 苹果废除了 32位应用,而AlipaySDK还是32位

解决办法:TARGETS-->Build Settings--> Architectures , 在Excluded Architectures 后加上 arm64 

同时将 Build Active Architecture Only 设置为 No (如下图)

building for iOS Simulator, but linking in object file built for iOS,……or architecture arm64_第2张图片

设置以上两项,就可以用模拟器在Release模式下运行(也可以在debug模式下运行)

不过真机调试的时候又出问题了:报

No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=arm64, VALID_ARCHS=arm64 arm64e armv7 armv7s, EXCLUDED_ARCHS=(

building for iOS Simulator, but linking in object file built for iOS,……or architecture arm64_第3张图片

这是后把上面的Excluded Architectures 加上的 arm64 删掉  Build Active Architecture Only 还原为 Yes 既可!

注:打包的时候也要把Excluded Architectures 加上的 arm64 删掉  Build Active Architecture Only 还原为 Yes !

总之就是很麻烦,总结为以下两句:

模拟器Release模式:Excluded Architectures 加上的 arm64 , Build Active Architecture Only 设置为 No

模拟器Debug模式,真机调试,打包上架: 把Excluded Architectures 加上的 arm64 删掉  Build Active Architecture Only 还原为 Yes。

 

如果还出现问题,可以看看这位老兄写的文章:

https://blog.csdn.net/ws1836300/article/details/108755295

 

你可能感兴趣的:(Xcode,ios,xcode)