Http://liuxing8807.blog.163.com/blog/static/9703530520133413353291/
Http://www.cnblogs.com/jay-dong/archive/2013/01/21/2870414.html
Shocould noted: http://useyourloaf.com/blog/2011/06/12/nsfilemanager-defaultmanager-is-not-thread-safe.html
Nsfilemanager * filemanager = [nsfilemanager defaultmanager];
If ([filemanager fileexistsatpath: sourcefile]) {
Nserror * error = nil;
If (! [Filemanager copyitematpath: sourcefile
Topath: destfile
Error: & error]) {
// Deal with error
}
}
The methods of the shared nsfilemanager object can be called from multiple threads safely. however, if you use a delegate to receive comprehensions about the status of move, copy, remove, and link operations, you shoshould create a unique instance
Of the File Manager object, assign your delegate to that object, and use that file manager to initiate your operations.
In iOS and Mac OS X V 10.5 and later you shoshould consider using [[nsfilemanager alloc] init] rather than the singleton method defaultmanager. instances ofnsfilemanager are considered thread-safe when created using [[nsfilemanager alloc] init].
This means that if your application ends up using the nsfilemanager Singleton from more than one thread you may get some unexpected results or even end up with your upted files in your file system. the thread safe version of the above code fragment
Wocould look like this:
Nsfilemanager * filemanager = [[nsfilemanager alloc] init];
If ([filemanager fileexistsatpath: sourcefile]) {
Nserror * error = nil;
If (! [Filemanager copyitematpath: sourcefile
Topath: destfile
Error: & error]) {
// Deal with error
}
}
[Filemanager release];