Sazzad Hissain Khan
Sazzad Hissain Khan

Reputation: 40226

Why isProtectedDataAvailable is not true inside applicationProtectedDataWillBecomeUnavailable?

Getting isProtectedDataAvailable true even inside applicationProtectedDataWillBecomeUnavailable delegate in AppDelegate.m (sometimes). As per documentation applicationProtectedDataWillBecomeUnavailable is called when protected data is unavailable so why I am getting it true?

- (void) applicationProtectedDataWillBecomeUnavailable:(UIApplication *)application {
    DDLogVerbose(TAG, "%d", [[UIApplication sharedApplication] isProtectedDataAvailable]);
}

isProtectedDataAvailable - The value of this property is false if data protection is enabled and the device is currently locked. The value of this property is set to true if the device is unlocked or if content protection is not enabled. When the value of this property is false, files that were assigned the complete or completeUnlessOpen protection key cannot be read or written by your app. The user must unlock the device before your app can access them.

Upvotes: 1

Views: 1386

Answers (1)

TylerP
TylerP

Reputation: 9829

As per documentation applicationProtectedDataWillBecomeUnavailable is called when protected data is unavailable

Not quite. From the docs for applicationProtectedDataWillBecomeUnavailable::

Tells the delegate that the protected files are about to become unavailable.

This method is posted shortly before the protected files become unavailable, meaning they are still available during the call to this method.

Upvotes: 2

Related Questions