Is there any way to detect if an iPhone\'s screen is on or off? For example, when the phone\'s screen lock button is pressed.
I\'ve been using (void)applicationWi
Yes, there is no definitive method. UIApplication
has a property protectedDataAvailable which will return YES
when screen is unlocked and NO
if locked only when user enables content protection. So this is the closest but unreliable I can think of. In such case, you can even listen to UIApplicationProtectedDataDidBecomeAvailable
and UIApplicationProtectedDataWillBecomeUnavailable
notifications.