iOS9 http 不能连接的解决办法
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替换为相应编译环境即可
posted on 2015-09-30 14:29 bibibi_liuliu 阅读(536) 评论(0) 编辑 收藏 举报