nath
nath

Reputation: 2848

iOS Data Protection not working on already installed app

I want to turn on 'Data Protection' in my app. Also, I wanted to check whether it is working with existing apps since I did not use it initially. To test this I used developer provisioning profile. First I installed the previous app (DataProtection is off) in my pass code enabled device and made sure that user's documents are available in the Documents folder. Then I turned on Data Protection in my provisioning profile and rebuilt the app using that new profile. Then I installed it on top of the previous app. Then I locked the device and downloaded the app sandbox using Xcode and noticed that I can access sandbox without any problem. I did it several times, but sandbox is still accessible.

Then I deleted the app and freshly installed the app that I had Data Protection turned on. Then I downloaded the app sandbox and I noticed that all folders in the sandbox including Documents folder are empty.

That means Data protection working only on freshly installed app. Am I doing anything wrong? I want to turn on Data Protection on my existing apps as well. How can I achieve this?

Upvotes: 3

Views: 355

Answers (1)

nath
nath

Reputation: 2848

Since I didn't get enough attention to this question I posted it to apple developer forum. What they suggest was after enabling data protection If We are going to update the app (without deleting old app) we should explicitly set data protection for all files including old ones.

So what I did was loop through my document folder and set data protection attribute to all my old files. Also I set data protection attributes in all places where I create new files. That solves my problem.

So the bottom line is If you are going to enable data protection in your old app better to do it explicitly.

Upvotes: 1

Related Questions