1 #!/bin/bash 2 3 # This script gets executed from Xcode to disable ATS (App Transport Security) 4 # on Debug builds. Doing this allows loading resources over HTTP, such as the 5 # JS bundle. 6 7 8 set -x 9 10 case "$CONFIGURATION" in 11 Debug) 12 # Speed up build times by skipping the creation of the offline package for debug 13 # builds on the simulator since the packager is supposed to be running anyways. 14 if [[ "$PLATFORM_NAME" == *simulator ]]; then 15 echo "Skipping bundling for Simulator platform" 16 exit 0; 17 fi 18 19 DEV=true 20 ;; 21 "") 22 echo "$0 must be invoked by Xcode" 23 exit 1 24 ;; 25 *) 26 DEV=false 27 ;; 28 esac 29 30 DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH 31 32 if [[ "$CONFIGURATION" = "Debug" && ! "$PLATFORM_NAME" == *simulator ]]; then 33 PLISTBUDDY='/usr/libexec/PlistBuddy' 34 PLIST=$TARGET_BUILD_DIR/$INFOPLIST_PATH 35 `$PLISTBUDDY -c "Add NSAppTransportSecurity:NSAllowsArbitraryLoads bool true" "$PLIST"` || true 36 fi