Is NSFileManager thread safe?

cocoa-touch, concurrency, grand-central-dispatch, nsfilemanager, objective-c

Solution

From NSFileManager Class Reference:

The methods of the shared NSFileManager object can be called from multiple threads safely. However, if you use a delegate to receive notifications about the status of move, copy, remove, and link operations, you should create a unique instance of the file manager object, assign your delegate to that object, and use that file manager to initiate your operations.

Problem

Is it ok to get an instance of NSFileManager via defaultManager and use it outside the main queue? Is this code ok? ``` dispatch_queue_t q = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_async(q, ^{ NSFileManager *fm = [NSFileManager defaultManager]; }); ```

Original source