随着 Xcode7的面世,咱们都清楚的知道,他能够不经过https://developer.apple.com中的测试证书就能够真机测试了,对于咱们开发者来讲这是一个很好地事情,可是也会出现一些问题。xcode
咱们在作项目的时候,或多或少的会用的到第三方类库,那么问题来了,当你用 xcode在真机(iOS 8.3)上运行一下工程,结果发现工程编译不过。看了下问题,报的是如下错误:app
ld: ‘/Users/**/Framework/SDKs/PolymerPay/Library/mobStat/lib**SDK.a(**ForSDK.o)’does not contain bitcode. You must rebuild it with bitcode enabled (Xcodesetting ENABLE_BITCODE), obtain an updated library from the vendor, or disablebitcode for this target. for architecture arm64ide
看警告能够获得的信息是"引入的一个第三方库不包含bitcode"。 嗯? bitcode 是神马东西呢?测试
好吧 咱们去查询一下API 吧,终于找到了优化
在 Distribution Guide–App Thinning (iOS, watchOS) 一节中,找到了:ui
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.this
说的是bitcode是被编译程序的一种中间形式的代码。包含bitcode配置的程序将会在App store上被编译和连接。bitcode容许苹果在后期从新优化程序的二进制文件,而不须要从新提交一个新的版本到App store上。spa
还有在What’s New in Xcode-New Features in Xcode 7中,还有一段以下的描述:code
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.blog
当提交程序到App store上时,Xcode会将程序编译为一个中间表现形式(bitcode)。而后App store会再将这个botcode编译为可执行的64位或32位程序。
可到这里,我仍是不太明白是神马意思,经过查阅相关资料,得出的结论是 这个东西应该和包得优化有关。
出现问题,咱们要想办法解决它
在上面的错误提示中,提到了如何处理咱们遇到的问题:
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
意思就是说:要不你第三方类库支持 bitcode 要不你就关掉它
好吧,咱们只能选择后者了
咱们来看看他在那里?
新建一个工程,咱们能够在”Build Settings”->”Enable Bitcode”选项中看到这个设置。固然我这里是改过的,其实新建的 xcode 工程 bitcode 是默认打开的!
好了改为 NO 就能够真机测试了!要是打包没有改成 NO 的话.再上传包的时候是能够看到这个选项的,截图我就不发了。