iOS9要求网络使用HTTPS协议-解决办法

iOS9要求App内访问的网络必须使用HTTPS协议。原有的HTTP请求会报错,适配方法以下。网络

打开TARGETS-Build Phases, 添加New Run Script Phase,代码以下:post

复制代码
# 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替换为相应编译环境便可ui

相关文章
相关标签/搜索