There is no direct way to distinguish between all the reasons why your application goes into the background. You can, however, call CFAbsoluteTimeGetCurrent()in applicationWillResignActive:, save the time stamp and check if enough time has passed in applicationDidBecomeActive:to guarantee that the PIN code is written. For example, if less than 10 seconds have passed, you can skip the PIN code. This makes your application less secure, but then it will bore users a bit.
Although this solution may seem far from ideal, in fact, it does not matter why your application abandoned its active state. Whatever the reason, it can become active after a very long time, and it cannot be activated again if iOS decides to stop it.
source
share