fix(scripts): local_test.sh --ios 检测不到已连 iPhone——设备状态匹配 connected
新版 Xcode devicectl 对 USB 直连并解锁的 iPhone 显示状态 'connected',脚本原来只筛 'available (paired)'(该状态在新版仅配对未直连的设备如 Apple Watch 才有),导致 '未检测到已配对 iPhone'。改为 grep iPhone 行 + 词匹配 connected|available(两版 Xcode 都收,-w 避免误命中 disconnected/unavailable)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -53,7 +53,9 @@ if [ "${1:-}" = "--ios" ]; then
|
||||
cd client
|
||||
flutter build ios --release --config-only "${DEFINES[@]}"
|
||||
cd ios
|
||||
CD_ID="$(xcrun devicectl list devices 2>/dev/null | grep 'available (paired)' | grep 'iPhone' | grep -oE '[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}' | head -1 || true)"
|
||||
# 已配对可安装的 iPhone:新版 Xcode(devicectl) USB 直连并解锁显示 "connected",
|
||||
# 旧版曾显示 "available (paired)";两者都收。-w 词匹配避免误命中 disconnected/unavailable。
|
||||
CD_ID="$(xcrun devicectl list devices 2>/dev/null | grep 'iPhone' | grep -Ew 'connected|available' | grep -oE '[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}' | head -1 || true)"
|
||||
if [ -z "$CD_ID" ]; then
|
||||
echo "!! 未检测到已配对 iPhone(插线并解锁后重试)" >&2
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user