Created
September 3, 2015 10:57
-
-
Save robnadin/637cfcbdab5ac04ac6f1 to your computer and use it in GitHub Desktop.
Xcode 7 run script phase to exclude a specific domain from App Transport Security via user-defined build settings
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
if [ "$ALLOW_INSECURE_HTTP_LOADS" = "YES" ]; then | |
PLIST_BUDDY="/usr/libexec/PlistBuddy" | |
cd "${TARGET_BUILD_DIR}" | |
DOMAIN_PATH=":NSAppTransportSecurity:NSExceptionDomains:${INSECURE_SERVER_HOST}" | |
$PLIST_BUDDY -c "Delete ${DOMAIN_PATH}" "${INFOPLIST_PATH}" | |
$PLIST_BUDDY -c "Add ${DOMAIN_PATH} dict" "${INFOPLIST_PATH}" | |
$PLIST_BUDDY -c "Add ${DOMAIN_PATH}:NSExceptionAllowsInsecureHTTPLoads bool true" "${INFOPLIST_PATH}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment