I need to detect lock & unlock events in my swift application.
I have tried using App Delegate functions like applicationProtectedDataWillBecomeUnavailable (to detect lock event) and applicationProtectedDataDidBecomeAvailable (to detect unlock event) but they have proven to be inconsistent.
The function applicationProtectedDataWillBecomeUnavailable is not called immediately when the phone is locked and some of the lock events are being missed altogether.
Can you suggest an approach that can guarantee the detection of lock & unlock everytime?
(This issue is not OS specific, and all the devices I have tested on have a passcode to unlock it.)