更新了iOS9和XCode7,以後,Swift變成了2.0,有了新的語法習慣,iOS也增強了安全方面的限制。咱們本來的項目就會出現很多問題。先來看我以前的項目中出現的3個錯誤吧和相關的解決辦法吧。swift
由於iOS9默認使用HTTPS的連接方式,因此若是你的程序之前使用的是HTTP方式進行網絡連接,那麼更新了以後,你的程序可能不會有bug,可是當運行的時候,遇到訪問HTTP的接口時,就會出現這樣的錯誤提示:xcode
App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file. The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.
因此,解決的辦法是在info.plist中添加進去新的項目:NSAppTransportSecurity 和 NSAllowsArbitraryLoads安全
注意,NSAppTransportSecurity的類型是Dictionary,NSAllowsArbitraryLoads的類型是Boolean,另外NSAllowsArbitraryLoads必定要放置在NSAppTransportSecurity的二級目錄之下。網絡
在iOS9以前,咱們基本上是偏向於使用MKPinAnnotationView的,由於MKPinAnnotationView若是設置了自定義的圖片,就會顯示之;若是不設置自定義的圖片,就會默認顯示大頭針的樣式。可是注意,到了iOS9,就不能使用MKPinAnnotationView這個類型了,由於它將再也不支持自定義的圖片,若是想要顯示自定義的圖片的話,必須使用MKAnnotationView這個類。app
可是這裏有個很尷尬的地方。好比你的工程裏面,有部分地圖上的點顯示默認的大頭針,有部分顯示自定義的圖片,須要在你的框架
mapView viewForAnnotation代理中返回兩個不一樣類型的Annotation,例以下面個人工程中的代碼(由於這個工程時間比較久,因此用的仍是OC,swift的話基本相似):ide
(null): URGENT: 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.ui
這個錯誤通常會出如今引入的第三方的框架中出現,是關於bitcode的。this
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.spa
因此解決的辦法也很簡單,步驟以下(從Statckoverflow上傳過來的):
注意一下,這個只有在Xcode7下面纔有。
暫時就只遇到這3個問題,有新的問題,我會接着更新blog。
轉自http://blog.csdn.net/u011156012/article/details/48707313