App兼容iOS9遇到的几个问题

请求网络出错

iOS9以后引入了新的特性“App Transport Security (ATS)”,要求访问接口要使用https,但是目前国内大多数App还是http,所以App请求是http时会报错。解决的方式是在info.plist中添加如下Dictionary:

1
2
App Transport Security Settings Dictionary
Allow Arbitrary Loads Boolean YES

使用第三方

比如你的App使用了微信登入等第三方功能,那你必须添加白名单,解决方式是在info.plist中创建如下Array:

1
2
3
LSApplicationQueriesSchemes: Array
item0 String weixin
item1 String wechat

Enable Bitcode

在编译的过程中,你可能会遇到类似这样的错误:

1
all bitcode will be dropped because '/Users/myname/Library/Mobile Documents/com~apple~CloudDocs/foldername/appname/GoogleMobileAds.framework/GoogleMobileAds(GADSlot+AdEvents.o)' was built without 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. Note: This will be an error in the future

这是因为在Build settings中bitcode被设置成了YES,如果你的App还没完全支持bitcode,请将它设置成NO。

Apple对Bitcode的描述:

1
2
3
4
5
Bitcode is an intermediate representation of a compiled program. Apps you upload to iTunes Connect that contain bitcode will be compiled and linked on the App Store. Including bitcode will allow Apple to re-optimize your app binary in the future without the need to submit a new version of your app to the store.

Xcode hides symbols generated during build time by default, so they are not readable by Apple. Only if you choose to include symbols when uploading your app to iTunes Connect would the symbols be sent to Apple. You must include symbols to receive crash reports from Apple.

Note: For iOS apps, bitcode is the default, but optional. If you provide bitcode, all apps and frameworks in the app bundle need to include bitcode. For watchOS apps, bitcode is required.

参考:
http://www.jianshu.com/p/631bd7f12a38
http://stackoverflow.com/questions/30848208/new-warnings-in-ios9