2016-01-13 100 views

回答

2

我找到的解決方案需要使用的PlistBuddy

在您的項目設置,選擇Build期>單擊+添加一個新的運行腳本生成階段。

命名階段「App Transport Security」。 粘貼以下腳本:

if [ "${CONFIGURATION}" = "Release" ]; 
then 
    /usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsArbitraryLoads false" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" 
else 
    /usr/libexec/PlistBuddy -c "Set :NSAppTransportSecurity:NSAllowsArbitraryLoads true" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" 
fi