diff --git a/test-apps/ios-test-app/scripts/build-and-deploy.sh b/test-apps/ios-test-app/scripts/build-and-deploy.sh index bd2d5ae..3b68658 100755 --- a/test-apps/ios-test-app/scripts/build-and-deploy.sh +++ b/test-apps/ios-test-app/scripts/build-and-deploy.sh @@ -97,16 +97,29 @@ fi # Boot simulator (only if specific device name provided) if [ "$SIMULATOR_DEVICE" != "Any iOS Simulator Device" ] && [ "$SIMULATOR_DEVICE" != "generic/platform=iOS Simulator" ]; then log_step "Booting simulator..." - if xcrun simctl list devices | grep -q "$SIMULATOR_DEVICE.*Booted"; then - log_info "Simulator already booted" + + # Check if simulator is already booted (more robust check) + BOOTED=$(xcrun simctl list devices | grep "$SIMULATOR_DEVICE" | grep -i "Booted" || echo "") + + if [ -n "$BOOTED" ]; then + log_info "✓ Simulator already booted: $SIMULATOR_DEVICE" else - if xcrun simctl boot "$SIMULATOR_DEVICE" 2>/dev/null; then - log_info "✓ Simulator booted" + log_info "Booting $SIMULATOR_DEVICE..." + # Try to boot by device name first + if xcrun simctl boot "$SIMULATOR_DEVICE" 2>&1; then + log_info "✓ Simulator booted successfully" + # Wait a moment for simulator to fully initialize + sleep 3 else log_warn "Could not boot simulator automatically" log_info "Opening Simulator app... (you may need to select device manually)" open -a Simulator sleep 5 + # Verify it's booted after opening + BOOTED=$(xcrun simctl list devices | grep "$SIMULATOR_DEVICE" | grep -i "Booted" || echo "") + if [ -z "$BOOTED" ]; then + log_warn "Simulator may not be booted. Continuing anyway..." + fi fi fi fi