fix(ios): correct UUID extraction from simulator list
Fixed UUID extraction to get device ID instead of status:
UUID Extraction Fix:
- Changed regex to match UUID format (36-char hex with dashes)
- UUID format: 68D19D08-4701-422C-AF61-2E21ACA1DD4C
- Previous regex was matching last parentheses (status: Shutdown)
- New regex specifically matches UUID pattern in first parentheses
Regex Pattern:
- Old: sed -n 's/.*(\([^)]*\)).*/\1/p' (matches any parentheses)
- New: sed -n 's/.*(\([0-9A-F-]\{36\}\)).*/\1/p' (matches UUID pattern)
- Fallback to old pattern if UUID pattern doesn't match
Fixes:
- Device ID extraction: Now correctly extracts UUID instead of status
- Build destination: Uses correct device ID for xcodebuild
- Simulator matching: xcodebuild can now find the correct device
Result: Script should now correctly extract and use device UUID for builds
This commit is contained in:
@@ -89,8 +89,14 @@ if [ -z "$1" ]; then
|
||||
else
|
||||
# Extract device name (everything before the first parenthesis)
|
||||
SIMULATOR_DEVICE=$(echo "$SIMULATOR_LINE" | sed 's/^[[:space:]]*\([^(]*\).*/\1/' | xargs)
|
||||
# Extract device ID (UUID in parentheses)
|
||||
SIMULATOR_ID=$(echo "$SIMULATOR_LINE" | sed -n 's/.*(\([^)]*\)).*/\1/p' | head -1)
|
||||
# Extract device ID (UUID in first set of parentheses, not status in second)
|
||||
# Format: " iPhone 17 Pro (68D19D08-4701-422C-AF61-2E21ACA1DD4C) (Shutdown)"
|
||||
# We want the UUID, which is in the first parentheses
|
||||
SIMULATOR_ID=$(echo "$SIMULATOR_LINE" | sed -n 's/.*(\([0-9A-F-]\{36\}\)).*/\1/p' | head -1)
|
||||
if [ -z "$SIMULATOR_ID" ]; then
|
||||
# Fallback: try to get first parentheses content (should be UUID)
|
||||
SIMULATOR_ID=$(echo "$SIMULATOR_LINE" | sed -n 's/.*(\([^)]*\)).*/\1/p' | head -1)
|
||||
fi
|
||||
log_info "Auto-detected simulator: $SIMULATOR_DEVICE (ID: $SIMULATOR_ID)"
|
||||
fi
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user