A string that uniquely identifies the file access that was performed by this file coordinator.
- iOS 5.0+
- macOS 10.7+
- tvOS 9.0+
- watchOS 2.0+
Coordinated reads and writes performed using the same purpose identifier never block each other, even if they occur in different processes. If you are coordinating file access on behalf of a file presenter, use
init(file and do not attempt to set a custom purpose identifier. Every file coordinator instance initialized with the same file presenter has the same purpose identifier.
You may need to set a custom purpose identifier for the following reasons:
Your application has a File Provider extension. Any file coordination done on behalf of the File Provider needs to be done using the File Provider’s purpose identifier.
You have two separate subsystems that need to work together to perform a single high-level operation, and both subsystems perform their own coordinated reads or writes. Using the same purpose identifier in both subsystems prevents possible deadlocks between the two subsystems.
When creating custom purpose identifiers, you can use a reverse DNS style string, such as
com, or a UUID string. You cannot use
nil or zero-length strings.