writeToFile如何判断它何时完成

我正在做一些数据写入我的文档目录,我想知道是否有办法告诉我什么时候writeToFile方法完成,我创build的文件已经完全创build。 在此先感谢这里是我打电话的方法我只是在寻找一种方法,它是一个委托方法或其他方式来告诉什么时候这个完成。

[imageData writeToFile:fullPathToFile atomically:YES]; 

缺口

writeToFile:atomically方法writeToFile:atomically是“同步的”。 它将写入文件,然后根据文件是否成功写入返回YESNO

这意味着只要方法返回,操作就完成了。

 BOOL success = [imageData writeToFile:fullPathToFile atomically:YES]; // Now, the operation is complete // success indicates whether the file was successfully written or not