一,bitcode
xcode7默認會開啓bitcode 會導致第三方框架報錯,下面是友盟的錯誤:libMobClickLibrary.a(MobClick.o)' 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
有兩種方式可以解決 :1,更新庫 2,build setting 中,搜索bitcode,並把 enable bitcode 設置爲 NO
二,https (ATS)
如果使用ios9 sdk編譯,,Foundation下默認所有http請求都被改爲https請求 如下修改info.plist:
For example you can add a specific domain like:
<key>NSAppTransportSecurity</key> <dict> <key>NSExceptionDomains</key> <dict> <key>yourserver.com</key> <dict> <!--Include to allow subdomains--> <key>NSIncludesSubdomains</key> <true/> <!--Include to allow HTTP requests--> <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key> <true/> <!--Include to specify minimum TLS version--> <key>NSTemporaryExceptionMinimumTLSVersion</key> <string>TLSv1.1</string> </dict> </dict> </dict>
The lazy option is:
<key>NSAppTransportSecurity</key> <dict> <!--Include to allow all connections (DANGER)--> <key>NSAllowsArbitraryLoads</key> <true/> </dict>
經過測試 所有通過NSURLConnection發送的請求都會被強制使用https
ASIHTTPRequest庫不會受到影響 因爲它底層是對CFNetwork的封裝。
需要注意的是 以上解決方法目前尚不清楚蘋果會不會拒絕上架,有條件的最好儘快改爲https.
三,企業證書
使用企業證書打包的app 第一次安裝時不會主動提示 信任/不信任
需要開發者到 設置->通用->描述文件->企業級應用 信任該證書
四:URL scheme
如果在應用中使用URL scheme調用其他應用必須在info.plist中將調用的scheme設置爲信任名單 否則無法使用。
LSApplicationQueriesSchemes(Array) -> urlscheme1 urlscheme2....
常見 URL Scheme
微信:wechat weixin
QQ:mqq mqqapi
支付寶:alipay alipayshare
新浪微博 :sinaweibo sinaweibosso weibosdk weibosdk2.5
五 directory not found for option問題
問題原因:Xcode7將framworks位置改變了。
解決方法:
點擊項目,選擇 Targets->build setting
找到 Frameworks Search Path 或者 Library Search Paths
刪除$(SDKROOT)/Developer/Library/Frameworks,
或者使用$(PLATFORM_DIR)/Developer/Library/Frameworks替換
六 項目運行報錯如下
<Error>: CGContextSaveGState: invalid context 0x0. If you
want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
<Error>: CGContextTranslateCTM: invalid context 0x0. If you
want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
<Error>: CGContextRestoreGState: invalid context 0x0. If you
want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
出錯原因:設置app的狀態欄樣式的使用使用了舊的方式,在info.plist裏面設置了View controller-based status bar appearance爲NO,默認爲YES,一般式iOS6的時候使用這種方式,iOS7,8也兼容,但是到了iOS9就報了警告。
解決辦法: 刪除 原先的設置代碼
//設置狀態欄的白色 [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
修改方式將View controller-based status bar appearance設置爲YES,然後使用新的方式來實現狀態欄的樣式。
在你的 自定義導航控制器裏面 寫上如下方法:
//設置狀態欄的(亮色)白色-(UIStatusBarStyle)preferredStatusBarStyle{ return UIStatusBarStyleLightContent;}
記住要clean 或者刪除應用程序 重新運行
七 升級Xcode 7 之後 ios 9 模擬器 一啓動程序 就直接報錯
報錯如下***** Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:],
/BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3505.16/UIApplication.m:3294**
原因:
新的SDK不允許在設置rootViewController之前做過於複雜的操作,導致在didFinishLaunchingWithOptions 結束後還沒有設置rootViewController
Xcode7需要所有UIWindow必須立即先設置一個rootViewController
解決辦法:
先設置個rootVIewController 之後重新賦值UIWindow *window = [[UIWindowalloc] initWithFrame:[UIScreenmainScreen].bounds];window.rootViewController
= [UIViewController new];