Skip to content

Commit

Permalink
FIX #9617 - Correct find local IP address when running on iOS device
Browse files Browse the repository at this point in the history
Find your mac's IP Address in en1 (wireless) if it doesn't find it in en0 (wired/ethernet) when react native xcode's script runs on iOS device
  • Loading branch information
guilhermebruzzi committed Sep 21, 2016
1 parent b3ee595 commit 54b6601
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packager/react-native-xcode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ if [[ "$CONFIGURATION" = "Debug" && "$PLATFORM_NAME" != "iphonesimulator" ]]; th
PLISTBUDDY='/usr/libexec/PlistBuddy'
PLIST=$TARGET_BUILD_DIR/$INFOPLIST_PATH
IP=$(ipconfig getifaddr en0)
if [ -z "$IP" ]; then
IP=$(ipconfig getifaddr en1)
fi
$PLISTBUDDY -c "Add NSAppTransportSecurity:NSExceptionDomains:localhost:NSTemporaryExceptionAllowsInsecureHTTPLoads bool true" "$PLIST"
$PLISTBUDDY -c "Add NSAppTransportSecurity:NSExceptionDomains:$IP.xip.io:NSTemporaryExceptionAllowsInsecureHTTPLoads bool true" "$PLIST"
echo "$IP.xip.io" > "$DEST/ip.txt"
Expand Down

0 comments on commit 54b6601

Please sign in to comment.