Apple Documentation reports the following:
Protected if not open. Files are encrypted. A closed file is not available when the device is locked. Once the device is unlocked, your application 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 application can continue accessing the file.
Enabling Storage Technologies
And:
Completed if it is already open. The file is encrypted. A closed file is not available while the device is locked. After the user opens the device, your application can open the file and use it. If the user locks the device while the file is open, although your application may continue to access it. Specify the NSDataWritingFileProtectionCompleteUnlessOpen (NSData) parameter or the NSFileProtectionCompleteUnlessOpen attribute (NSFileManager).
Protecting data with disk encryption
This seems like a great option, allowing me to finish any remaining work on the file and then close it myself. The documentation does not say what happens to the file when I close it. For example, what happens when:
- The user opens the application and opens the file in the application
- The user locks the device (the file remains unprotected because it is open)
- The application performs the remaining operations with the file
- Application closes file
Now, is the file protected since it is now closed? Or can it be reopened?
source share