标签:
iOS9要求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替换为相应编译环境即可
标签:
原文地址:http://www.cnblogs.com/cdp-snail/p/4907947.html