jailbreakiphone-privateapi

How to unlock iOS screen programmatically?


I'm currently exploring creating a jailbreak tweak. I want to unlock the phone screen. How is this done? What private API can be used to achieve this on iOS 7?


Solution

  • If we are talking about jailbreak then you can write a SpringBoard tweak that does this (iOS 7 only)

    [[objc_getClass("SBBacklightController") sharedInstance] turnOnScreenFullyWithBacklightSource:0];
    [[objc_getClass("SBLockScreenManager") sharedInstance] unlockUIFromSource:0 withOptions:nil];
    

    Without passcode lock the code will turn on the screen and unlock the device. With passcode it will turn on the screen and request passcode.