diff --git a/scripts/react-native-xcode.sh b/scripts/react-native-xcode.sh index 328085fb5204c9..f0cfa0fd54f12d 100755 --- a/scripts/react-native-xcode.sh +++ b/scripts/react-native-xcode.sh @@ -14,10 +14,12 @@ DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH # Enables iOS devices to get the IP address of the machine running Metro if [[ "$CONFIGURATION" = *Debug* && ! "$PLATFORM_NAME" == *simulator ]]; then - IP=$(ipconfig getifaddr en0) - if [[ -z "$IP" || -n "`ifconfig $value | grep 'baseT'`" ]]; then - IP=$(ipconfig getifaddr en1) - fi + for num in 0 1 2 3 4 5 6 7 8; do + IP=$(ipconfig getifaddr en${num}) + if [ ! -z "$IP" ]; then + break + fi + done if [ -z "$IP" ]; then IP=$(ifconfig | grep 'inet ' | grep -v ' 127.' | grep -v ' 169.254.' |cut -d\ -f2 | awk 'NR==1{print $1}') fi