in my iPhone projects, I am currently copying files using NSFileManager's -copyItemAtPath:toPath:error: method. However, the docs so not say anything about atomicity, so I might run into trouble if my app tries to read a file that is currently being replaced by another thread.
Is there a开发者_开发知识库 way to copy or replace a file atomically? I am searching for something like NSData's -writeDataToFilr:atomically:.
How do you use NSFileManager? According to the docs, it says the following:
In iOS and Mac OS X v 10.5 and later you should consider using
[[NSFileManager alloc] init]rather than the singleton methoddefaultManager. Instances ofNSFileManagerare considered thread-safe when created using[[NSFileManager alloc] init].
加载中,请稍侯......
精彩评论