@@ -41,7 +41,7 @@ export async function runIosDevicectl(
4141 stdout,
4242 stderr,
4343 deviceId : context . deviceId ,
44- hint : resolveIosDevicectlHint ( stdout , stderr ) ,
44+ hint : resolveIosDevicectlHint ( stdout , stderr ) ?? IOS_DEVICECTL_DEFAULT_HINT ,
4545 } ) ;
4646}
4747
@@ -80,7 +80,7 @@ export async function listIosDeviceApps(
8080 stdout,
8181 stderr,
8282 deviceId : device . id ,
83- hint : resolveIosDevicectlHint ( stdout , stderr ) ,
83+ hint : resolveIosDevicectlHint ( stdout , stderr ) ?? IOS_DEVICECTL_DEFAULT_HINT ,
8484 } ) ;
8585 }
8686 const jsonText = await fs . readFile ( jsonPath , 'utf8' ) ;
@@ -119,13 +119,16 @@ function filterIosDeviceApps(apps: IosAppInfo[], filter: 'user-installed' | 'all
119119 return apps ;
120120}
121121
122- export function resolveIosDevicectlHint ( stdout : string , stderr : string ) : string {
122+ export const IOS_DEVICECTL_DEFAULT_HINT =
123+ 'Ensure the iOS device is unlocked, trusted, and available in Xcode > Devices, then retry.' ;
124+
125+ export function resolveIosDevicectlHint ( stdout : string , stderr : string ) : string | null {
123126 const text = `${ stdout } \n${ stderr } ` . toLowerCase ( ) ;
124127 if ( text . includes ( 'device is busy' ) && text . includes ( 'connecting' ) ) {
125128 return 'iOS device is still connecting. Keep it unlocked and connected by cable until it is fully available in Xcode Devices, then retry.' ;
126129 }
127130 if ( text . includes ( 'coredeviceservice' ) && text . includes ( 'timed out' ) ) {
128131 return 'CoreDevice service timed out. Reconnect the device and retry; if it persists restart Xcode and the iOS device.' ;
129132 }
130- return 'Ensure the iOS device is unlocked, trusted, and available in Xcode > Devices, then retry.' ;
133+ return null ;
131134}
0 commit comments