運行時候,app鏈接不上服務(wù)器愤估,請求不到數(shù)據(jù)绘梦,控制臺報錯:
The resource could not be loaded because the App Transport Security policy
這個是iOS9以后引入的新特性App Transport Security (ATS)歉闰。詳情:App Transport Security (ATS)
這個新特性要求App內(nèi)訪問的網(wǎng)絡(luò)必須使用HTTPS協(xié)議。
如果用的是HTTP協(xié)議的話荒揣,解決方法如下:
1拧略、在Info.plist 中添加NSAppTransportSecurity 類型 Dictionary砂客。
2岛蚤、在NSAppTransportSecurity 下添加NSAllowsArbitraryLoads 類型 Boolean酝锅,值設(shè)為YES。
1-1.png
參考:
App Transport Security support aka apps on iOS 9 don't work #4560
711_networking_with_nsurlsession.pdf
http://blog.csdn.net/feixiang_song/article/details/47188223