Skip to content

Commit

Permalink
Handle DeviceHasPasscodeSetError when launching iOS apps
Browse files Browse the repository at this point in the history
  • Loading branch information
morellexf13 committed Sep 28, 2023
1 parent 1c7a988 commit dc4cf6d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pymobiledevice3/services/dvt/instruments/process_control.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import typing

from pymobiledevice3.exceptions import DeviceHasPasscodeSetError, DvtException
from pymobiledevice3.services.remote_server import MessageAux


Expand Down Expand Up @@ -42,7 +43,11 @@ def launch(self, bundle_id: str, arguments=None, kill_existing: bool = True, sta
'StartSuspendedKey': start_suspended,
'KillExisting': kill_existing,
})
self._channel.launchSuspendedProcessWithDevicePath_bundleIdentifier_environment_arguments_options_(args)
result = self._channel.receive_plist()
try:
self._channel.launchSuspendedProcessWithDevicePath_bundleIdentifier_environment_arguments_options_(args)
result = self._channel.receive_plist()
except DvtException as exc:
error = exc.args[0]["NSLocalizedFailureReason"]
raise DeviceHasPasscodeSetError() if "the device was not, or could not be, unlocked" in error else error
assert result
return result

0 comments on commit dc4cf6d

Please sign in to comment.