From what I understand, UIApplication.sharedApplication().protectedDataAvailable should return false when the phone is locked and protected data is enabled on the iPhone (apparently setting a passcode enables it).
However, despite of the scenario, it always returns true.
Once my app gets reawaken by iOS due to Corebluetooth State Preservation and Restoration, I need to immediately know whether the phone is locked.
I've implemented event listeners to know when the phone gets locked/unlocked, but they are only useful once the lock state changes, I am unable to determine the lock state prior to an event.
Any ideas? Thanks
UPDATE:
this is what I use in applicationDidFinishLaunchingWithOptions:
self.phoneLockDetection.isPhoneLocked = !UIApplication.sharedApplication().protectedDataAvailable