iOS 9已經可以開放下載了
最近自家的App在iOS 9 上面發生了一些問題
透過URL request 一些WebService的時候會發生錯誤
在info.plist 中加上下面這段
NSAppTransportSecurity Dictionary
NSAllowsArbitraryLoads BOOL
網路上找到更好的解釋
文章來源:
LiuLiu's 笔记本
http://www.cnblogs.com/liuliuliu/p/4849134.html
OS9要求App内访问的网络必须使用HTTPS协议。原有的HTTP请求会报错,适配方法如下。
打开TARGETS-Build Phases, 添加New Run Script Phase,代码如下:
# Add exception for Debug builds if [ "${CONFIGURATION}" == "Debug" ] then # Remove exception existing builds /usr/libexec/PlistBuddy -c "Delete :NSAppTransportSecurity:NSAllowsArbitraryLoads" "${CONFIGURATION_BUILD_DIR}/${INFOPLIST_PATH}" exitCode=$? #Supresses failure /usr/libexec/PlistBuddy -c "Add :NSAppTransportSecurity:NSAllowsArbitraryLoads bool true" "${CONFIGURATION_BUILD_DIR}/${INFOPLIST_PATH}" fi
其中"${CONFIGURATION}" == "Debug"的Debug替换为相应编译环境即可
文章標籤
全站熱搜