Created
January 20, 2016 04:25
-
-
Save mpvosseller/8897b379f040e0ca1476 to your computer and use it in GitHub Desktop.
Xcode Build Phase Run Script to Disable AppTransportSecurity in DEBUG Simulator Builds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## Disable AppTransportSecurity in DEBUG Simulator Builds | |
if [[ ${CONFIGURATION} == "Debug" ]] && [[ $PLATFORM_NAME == *"simulator"* ]]; then | |
TARGET_INFOPLIST="${CONFIGURATION_BUILD_DIR}/${INFOPLIST_PATH}" | |
## Delete NSAppTransportSecurity entry if it already exists | |
/usr/libexec/PlistBuddy -c "Delete :NSAppTransportSecurity" "${TARGET_INFOPLIST}" 2>/dev/null | |
## Add NSAppTransportSecurity dictionary entry | |
/usr/libexec/PlistBuddy -c "Add :NSAppTransportSecurity dict" "${TARGET_INFOPLIST}" | |
## Add NSAllowsArbitraryLoads = true to the NSAppTransportSecurity dictionary | |
/usr/libexec/PlistBuddy -c "Add :NSAppTransportSecurity:NSAllowsArbitraryLoads bool true" "${TARGET_INFOPLIST}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment