iOS 集成支付宝支付编译出现的问题及解决办法
2016-01-22 12:11
501 查看
问题:
/ALiPay/AlipaySDK.framework/AlipaySDK’ does not contain bitcode. You must rebuild it with bitcode enabled (Xcode
setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
原因分析:
是由于支付宝AlipaySDK的二进制库不支持bitcode.而Xcode默认是要支持bitcode的,而且如果支持的话,其中所有的二进制库和framework都必须包含bitcode。
解决办法:
在build setting 中搜索bitcode,并设置Enable Bitcode为NO即可。
延伸
Bitcode是个什么呢@.@
在App Distribution Guide–App Thinning (iOS, watchOS)一节中,找到了下面这样一个定义:
Bitcode is an intermediate representationof a compiled program. Apps you upload to iTunes Connect that contain bitcodewill be compiled and linked on the App Store. Including bitcode will allowApple to re-optimize your app binary
in the future without the need to submit anew version of your app to the store.
说的是bitcode是被编译程序的一种中间形式的代码。包含bitcode配置的程序将会在App store上被编译和链接。bitcode允许苹果在后期重新优化程序的二进制文件,而不需要重新提交一个新的版本到App store上。
而在What’s New in Xcode-New Features in Xcode 7中,还有一段如下的描述:
Bitcode. When you archive for submission tothe App Store, Xcode will compile your app into an intermediate representation.The App Store will then compile the bitcode down into the 64 or 32 bitexecutables as necessary.
当提交程序到App store上时,Xcode会将程序编译为一个中间表现形式(bitcode)。然后App store会再将这个botcode编译为可执行的64位或32位程序。
再看看这两段描述,都是放在App Thinning(App瘦身)一节中,可以看出其与包的优化有关了。
Bitcode配置
在上面的错误提示中,提到了如何处理我们遇到的问题:
You must rebuild it with bitcode enabled(Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, ordisable bitcode for this target. for architecture arm64
要么让第三方库支持,要么关闭target的bitcode选项。
实际上,在Xcode 7中,我们新建一个iOS程序时,bitcode选项默认是设置为YES的。我们可以在”Build Settings”->”Enable Bitcode”选项中看到这个设置。不过,我们现在需要考虑的是三个平台:iOS,Mac OS,watchOS。
对于iOS,bitcode是可选的;对于watchOS,bitcode是必须的;而Mac OS是不支持bitcode。
如果我们开启了bitcode,在提交包时,下面这个界面也会有个bitcode选项:
所以,如果我们的工程需要支持bitcode,则必要要求所有引入的第三方库都支持bitcode。
/ALiPay/AlipaySDK.framework/AlipaySDK’ does not contain bitcode. You must rebuild it with bitcode enabled (Xcode
setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
原因分析:
是由于支付宝AlipaySDK的二进制库不支持bitcode.而Xcode默认是要支持bitcode的,而且如果支持的话,其中所有的二进制库和framework都必须包含bitcode。
解决办法:
在build setting 中搜索bitcode,并设置Enable Bitcode为NO即可。
延伸
Bitcode是个什么呢@.@
在App Distribution Guide–App Thinning (iOS, watchOS)一节中,找到了下面这样一个定义:
Bitcode is an intermediate representationof a compiled program. Apps you upload to iTunes Connect that contain bitcodewill be compiled and linked on the App Store. Including bitcode will allowApple to re-optimize your app binary
in the future without the need to submit anew version of your app to the store.
说的是bitcode是被编译程序的一种中间形式的代码。包含bitcode配置的程序将会在App store上被编译和链接。bitcode允许苹果在后期重新优化程序的二进制文件,而不需要重新提交一个新的版本到App store上。
而在What’s New in Xcode-New Features in Xcode 7中,还有一段如下的描述:
Bitcode. When you archive for submission tothe App Store, Xcode will compile your app into an intermediate representation.The App Store will then compile the bitcode down into the 64 or 32 bitexecutables as necessary.
当提交程序到App store上时,Xcode会将程序编译为一个中间表现形式(bitcode)。然后App store会再将这个botcode编译为可执行的64位或32位程序。
再看看这两段描述,都是放在App Thinning(App瘦身)一节中,可以看出其与包的优化有关了。
Bitcode配置
在上面的错误提示中,提到了如何处理我们遇到的问题:
You must rebuild it with bitcode enabled(Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, ordisable bitcode for this target. for architecture arm64
要么让第三方库支持,要么关闭target的bitcode选项。
实际上,在Xcode 7中,我们新建一个iOS程序时,bitcode选项默认是设置为YES的。我们可以在”Build Settings”->”Enable Bitcode”选项中看到这个设置。不过,我们现在需要考虑的是三个平台:iOS,Mac OS,watchOS。
对于iOS,bitcode是可选的;对于watchOS,bitcode是必须的;而Mac OS是不支持bitcode。
如果我们开启了bitcode,在提交包时,下面这个界面也会有个bitcode选项:
所以,如果我们的工程需要支持bitcode,则必要要求所有引入的第三方库都支持bitcode。
相关文章推荐
- iOS 9之应用内搜索(CoreSpotlight)API
- iOS 学习资料
- iOS 学习资料
- iOS-蓝牙学习1
- iOS开发new与alloc/init的区别
- iOS开发new与alloc/init的区别
- [OCLint]iOS项目中使用OCLint指导手册
- IOS开发防止图片渲染的方法
- iOS 数组遍历删除元素的问题
- iOS程序猿之本地通知那些事
- iOS 关于presentViewController弹出页面反应迟钝的问题
- IOS图片压缩(修改图片大小)
- iOS开发常用的第三方资源
- iOS 熟练使用LLDB,让你debug事半功倍
- iOS程序猿之NSdate那些事
- iOS字符串转数组,数组转字符串
- IOS 锁
- IOS 截取整个scrollView区域图片
- iOS中label根据字体和行间距返回高度
- 一个简单的筛选控件