Xcode 升級到7.3beta版后,做http的網絡訪問的時候會報錯:
error------ Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}
網絡搜索之后才知道,Xcode9引入了新特性ATS,要求app訪問的網絡必須使用HTTPS協議。如果想要繼續訪問http網頁,需要在info.plist文件中添加NSAppTransportSecurity關鍵字,其類型為Dictionary,在它下面添加NSAllowsArbitraryLoads類型Boolean,值設為YES。這樣就可以接著訪問http網頁啦~~