Skip to content

Commit 1dc03bb

Browse files
committed
fix(apple): answer a developer disk image complaint with device support
One `devicectl` hint covered both "developer mode is disabled" and "developer disk image", and it named Developer Mode. That pairing runs one way only: a phone with the toggle off cannot mount the image either. The reverse is common — a device whose toggle is on, waiting for Xcode to finish installing device support — and people were sent to a Settings pane that was already correct while the actual wait went unmentioned. The two complaints are answered apart now. When the output names both, the toggle still wins, since it is the one that explains the other. #2683 adds the device's own reading of both states, which is what lets the tool-output path stop guessing which one it is looking at.
1 parent aa8e046 commit 1dc03bb

2 files changed

Lines changed: 43 additions & 5 deletions

File tree

‎packages/platform-apple/src/core/__tests__/devicectl.test.ts‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,31 @@ test('parseIosDeviceProcessesPayload maps running process entries', () => {
7070
]);
7171
});
7272

73-
test('resolveIosDevicectlHint points at Developer Mode when the disk image cannot mount', () => {
73+
test('resolveIosDevicectlHint names the developer disk image when that is all it reports', () => {
7474
// Observed on a freshly paired iPhone: unlocked, trusted, `available (paired)`
75-
// in Xcode, and still unusable because Developer Mode was off. The default
76-
// hint sent the user to re-check trust, which was already fine.
75+
// in Xcode, and still unusable. This line used to be answered with Developer
76+
// Mode advice, which is right often enough to survive as a guess and wrong
77+
// whenever Xcode simply has not finished installing device support on a phone
78+
// whose toggle is already on (#2683). The device reports both states apart, so
79+
// the hint answers the one the output named.
7780
const hint = resolveIosDevicectlHint(
7881
'',
7982
'Failed to launch iOS app: The developer disk image could not be mounted on this device. (com.apple.dt.CoreDeviceError error 12040 (0x2F08))',
8083
);
8184

85+
assert.match(String(hint), /device support/i);
86+
assert.doesNotMatch(String(hint), /Developer Mode/);
87+
});
88+
89+
test('resolveIosDevicectlHint names Developer Mode when the output says both', () => {
90+
// The pairing this hint was written for: a phone with the toggle off cannot
91+
// mount the image either, so the toggle is the thing to fix and the direction
92+
// that genuinely holds (#2683).
93+
const hint = resolveIosDevicectlHint(
94+
'',
95+
'The operation failed because Developer Mode is disabled. The developer disk image could not be mounted on this device.',
96+
);
97+
8298
assert.match(String(hint), /Developer Mode/);
8399
assert.match(String(hint), /Privacy & Security/);
84100
});

‎packages/platform-apple/src/core/devicectl.ts‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,21 @@ export const IOS_DEVICECTL_DEFAULT_HINT =
297297
const IOS_DEVICE_PROCESS_LIST_HINT =
298298
"This Xcode/CoreDevice toolchain must support 'devicectl device info processes' with JSON runningProcesses so agent-device can resolve app process IDs. Inspect diagnostics for the exact devicectl API failure.";
299299

300+
/**
301+
* The answer for a device whose own Developer Mode toggle is off (#2683). The device fact publishes
302+
* this same string, so the tool-output path and the device path cannot drift apart.
303+
*/
304+
const IOS_DEVICE_DEVELOPER_MODE_OFF_HINT =
305+
'Enable Developer Mode on the iOS device (Settings > Privacy & Security > Developer Mode), restart it when prompted, unlock it, then retry.';
306+
307+
/**
308+
* The answer for a developer disk image complaint on its own (#2683). It is deliberately not a
309+
* Developer Mode answer: a device can have the toggle on and still be waiting for Xcode to install
310+
* device support, and sending someone to a setting that is already correct loses the actual cause.
311+
*/
312+
const IOS_DEVICE_DEVELOPER_DISK_IMAGE_HINT =
313+
'Let Xcode finish preparing this device: keep it unlocked and connected by cable, open Xcode > Settings > Platforms (or Window > Devices and Simulators), wait for device support to install, then retry.';
314+
300315
export function resolveIosDevicectlHint(stdout: string, stderr: string): string | null {
301316
const text = `${stdout}\n${stderr}`.toLowerCase();
302317
if (text.includes('device is busy') && text.includes('connecting')) {
@@ -310,8 +325,15 @@ export function resolveIosDevicectlHint(stdout: string, stderr: string): string
310325
// usual state of a phone that has never been used for development. The
311326
// default hint sends people to check trust and Xcode, none of which is wrong
312327
// yet none of which is the cause.
313-
if (text.includes('developer disk image') || text.includes('developer mode is disabled')) {
314-
return 'Enable Developer Mode on the iOS device (Settings > Privacy & Security > Developer Mode), restart it when prompted, unlock it, then retry.';
328+
//
329+
// The two complaints are answered apart (#2683): an image line by itself is not evidence that the
330+
// toggle is off, and the device reports both states directly, so the name of one is never used as
331+
// the name of the other.
332+
if (text.includes('developer mode is disabled')) {
333+
return IOS_DEVICE_DEVELOPER_MODE_OFF_HINT;
334+
}
335+
if (text.includes('developer disk image')) {
336+
return IOS_DEVICE_DEVELOPER_DISK_IMAGE_HINT;
315337
}
316338
if (text.includes('must be paired')) {
317339
return 'Pair the iOS device with this Mac: connect it by cable, unlock it, accept the Trust prompt, and enter the device passcode, then retry.';

0 commit comments

Comments
 (0)