iOS Question File Data Protection

schimanski

Well-Known Member
Licensed User
Longtime User
Apple uses a system named File Data Protection to protect the app-data in the directories "documents/“ und „library/“. There are four types von file-protection:


NSFileProtectionComplete,
NSFileProtectionCompleteUnlessOpen,
NSFileProtectionCompleteUntilFirstUserAuthentication and
NSFileProtectionNone.


Is there a way to set the file protection by code?


Thanks for answer!
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Enable data protection in your App Id (you might need an explicit app id):

SS-2018-05-17_08.35.46.png


2. Create a new provision profile.

3. Add to your project:
B4X:
#Entitlement: <key>com.apple.developer.default-data-protection</key><string>NSFileProtectionComplete</string>

This seems to work though it is not clear how it can be tested.
 
Upvote 0
Top