SBGetScreenLockStatus (iPhone / iPad / iOS)

I figured out the parameters for the iOS SpringBoard SBGetScreenLockStatus method.  At first I was sure it would only be setting one bool to say if it was locked or not, but actually it turns out that it sets two.  The second just tells you whether or a passcode is enabled.  I’m calling it via the SpringBoardServices so it’s simply…

bool locked;
bool passcode;
void* (*SBGetScreenLockStatus)(mach_port_t* port, bool *lockStatus, bool *passcodeEnabled) = dlsym(sbserv, "SBGetScreenLockStatus");
SBGetScreenLockStatus(sbPort, &locked, &passcode);
  • fantasy614

    thank you for sharing this,but i want to know how to find SBGetScreenLockStatus have two parameters,and it parameter type

  • spencer

    ok but what are sbserve and sbport and what do I #import to gain access to dlsym?

    • marek

      You need to manually load the SpringBoard services framework using dlopen. The path to it is /System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices.

      • spencer

        Will the App Store reject my app if I use this implementation?

        • marek

          Yup, definite rejection. There is no way to get the screen lock status in a way that Apple will approve for the store.

          • spencer

            Ok, thanks so much!