Hello.
I have an CoreData app that explicitly enables the data protection capability and sets "NSFileProtectionComplete" in the entitlements. However, if I check the file attributes on the 3 files of the sqlite database I see that these are set to "NSFileProtectionCompleteUntilFirstUserAuthentication" The parent directory ("Application Support") is correctly set to "NSFileProtectionComplete". What am I missing?
BR
Björn
For NSPersistentContainer, you have to configure a NSPersistentStoreDescription object, use setOption( forKey:) to set the NSPersistentStoreFileProtectionKey option, and put that in the persistentStoreDescriptions. I'm not sure if that means you'll have to fill out all of the other properties of the StoreDescription.
For strange reasons, Core Data chooses to default to completeUntilFirstUserAuthentication instead of what the app is set to. But, according to the documentation for the persistent store option:
"Backward compatibility may preclude some features. The acceptable values are those defined for the
protectionKey
. The default value is completeUntilFirstUserAuthentication
for all applications built on or after iOS v5.0. The default value for all older applications is none
."