5

While working on iOS, Objective C, I found the delegate of UIApplicationDelegate,

applicationProtectedDataDidBecomeAvailable

is getting called multiple times after device unlocked. What could be the possible reasons?


applicationProtectedDataDidBecomeAvailable - On a device that uses content protection, protected files are stored in an encrypted form and made available only at certain times, usually when the device is unlocked. This notification lets your app know that the device is now unlocked and that you may access certain types of protected files again.

Sazzad Hissain Khan
  • 37,929
  • 33
  • 189
  • 256

2 Answers2

2

It is a known and normal function of the call.

According to the documentation on 'applicationProtectedDataDidBecomeAvailable' is called continually in order to tell the delegate that protected files are available now. so on lock certain files are not available.

On a device that uses content protection, protected files are stored in an encrypted form and made available only at certain times, usually when the device is unlocked. This notification lets your app know that the device is now unlocked and that you may access certain types of protected files again.

Reference: https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623044-applicationprotecteddatadidbecom

I hope this helped. let me know.

mw509
  • 1,957
  • 1
  • 19
  • 25
  • But I don't get `applicationProtectedDataDidBecomeUnavailable` in between two subsequent call of `applicationProtectedDataDidBecomeAvailable`. Why fw calling available before data becomes unavailable? Its confusion right? – Sazzad Hissain Khan Mar 03 '20 at 09:22
  • Well it is but I guess that is just how it works. Maybe it will change in future devs but as long as your codes still work, you are good to go! – mw509 Mar 03 '20 at 09:28
1

Most of the delegates are called when corresponding functions are triggered. M8 be there were 10 encrypted files and these 10 files triggers this delegate individually when the device is unlocked, and we are supposed to find whether the file we are looking for is ready to use. for more details about encrypted files check this link out.

They were also speaking about location, camera, gallery so and so as the Protected datas and resources.

AlbinMrngStar
  • 289
  • 2
  • 13
  • check this link https://developer.apple.com/documentation/uikit/protecting_the_user_s_privacy/requesting_access_to_protected_resources. I have updated my answer. check it and you probably know how to get access to the camera and locations r8. – AlbinMrngStar Mar 03 '20 at 17:39