Skip to content

Commit 4dc1bd4

Browse files
authored
Handle updated error message when iOS device is locked (#108057)
1 parent 201be6b commit 4dc1bd4

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

packages/flutter_tools/lib/src/ios/ios_deploy.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import 'iproxy.dart';
2222
const String noProvisioningProfileErrorOne = 'Error 0xe8008015';
2323
const String noProvisioningProfileErrorTwo = 'Error 0xe8000067';
2424
const String deviceLockedError = 'e80000e2';
25+
const String deviceLockedErrorMessage = 'the device was not, or could not be, unlocked';
2526
const String unknownAppLaunchError = 'Error 0xe8000022';
2627

2728
class IOSDeploy {
@@ -520,7 +521,7 @@ String _monitorIOSDeployFailure(String stdout, Logger logger) {
520521
logger.printError(noProvisioningProfileInstruction, emphasis: true);
521522

522523
// Launch issues.
523-
} else if (stdout.contains(deviceLockedError)) {
524+
} else if (stdout.contains(deviceLockedError) || stdout.contains(deviceLockedErrorMessage)) {
524525
logger.printError('''
525526
═══════════════════════════════════════════════════════════════════════════════════
526527
Your device is locked. Unlock your device first before running.

packages/flutter_tools/test/general.shard/ios/ios_deploy_test.dart

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ void main () {
258258
expect(logger.errorText, contains('No Provisioning Profile was found'));
259259
});
260260

261-
testWithoutContext('device locked', () async {
261+
testWithoutContext('device locked code', () async {
262262
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
263263
const FakeCommand(
264264
command: <String>['ios-deploy'],
@@ -273,6 +273,21 @@ void main () {
273273
expect(logger.errorText, contains('Your device is locked.'));
274274
});
275275

276+
testWithoutContext('device locked message', () async {
277+
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
278+
const FakeCommand(
279+
command: <String>['ios-deploy'],
280+
stdout: '[ +95 ms] error: The operation couldn’t be completed. Unable to launch io.flutter.examples.gallery because the device was not, or could not be, unlocked.',
281+
),
282+
]);
283+
final IOSDeployDebugger iosDeployDebugger = IOSDeployDebugger.test(
284+
processManager: processManager,
285+
logger: logger,
286+
);
287+
await iosDeployDebugger.launchAndAttach();
288+
expect(logger.errorText, contains('Your device is locked.'));
289+
});
290+
276291
testWithoutContext('unknown app launch error', () async {
277292
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
278293
const FakeCommand(

0 commit comments

Comments
 (0)