Apple's Documentation says the following:
Protected Unless Open. Files are encrypted. A closed file is inaccessible when the device is locked. After the device is unlocked, your app can open and use the file. If the user has a file open and locks the device (for example, by pressing the sleep button), your app can continue to access the file.
And also:
Complete unless already open. The file is encrypted. A closed file is inaccessible while the device is locked. After the user unlocks the device, your app can open the file and use it. If the user locks the device while the file is open, though, your app can continue to access it. Specify the NSDataWritingFileProtectionCompleteUnlessOpen option (NSData) or the NSFileProtectionCompleteUnlessOpen attribute (NSFileManager).
Protecting Data Using On-Disk Encryption
This seems like a great option for allowing me to finish up any remaining work on the file and then closing it myself. What the documentation doesn't say is what happens to the file when I close it. For instance what happens when:
- User opens app and opens file within app
- User locks device (file remains unprotected because it is open)
- App performs remaining operations on file
- App closes the file
Now, is the file protected since it is now closed? Or can it be reopened?