github doronz88/pymobiledevice3 v11.12.5

3 hours ago

Highlights

✨ Dedicated exceptions for common lockdown errors

lockdownd answers a rejected request with an Error string, and until now three of the most
actionable ones all collapsed into a generic LockdownError, leaving callers to string-match the
message to tell them apart. They now raise their own exception types, so you can recover from each
condition on its own terms:

lockdown Error exception meaning
MCProtected MCProtectedError a mobile configuration (MDM) policy prohibits the action
PasscodeRequired PasscodeRequiredError the device must have a passcode set first
SessionActive SessionActiveError a lockdown session is already active (e.g. pairing verified twice)

All three subclass LockdownError and keep the original error text, device identifier and
product_version, so existing except LockdownError handlers keep working unchanged.

from pymobiledevice3.exceptions import MCProtectedError, PasscodeRequiredError
from pymobiledevice3.lockdown import create_using_usbmux

lockdown = await create_using_usbmux()
try:
    await lockdown.set_value(True, "com.apple.mobile.wireless_lockdown", "EnableWifiConnections")
except MCProtectedError:
    print("blocked by an MDM profile")
except PasscodeRequiredError:
    print("set a device passcode first")

Resolves #708. Thanks @NspxMiguel for the contribution!

What's Changed

New Contributors

Full Changelog: v11.12.4...v11.12.5

Don't miss a new pymobiledevice3 release

NewReleases is sending notifications on new releases.