NSData writeToFile:atomically: doesn't immediately save the file

后端 未结 1 702
执念已碎
执念已碎 2021-01-13 01:12

I\'m downloading an SQLite db from the web into my iPad app. If I write it to disk setting atomically: YES I can\'t immediately use it because even though the f

相关标签:
1条回答
  • 2021-01-13 01:41

    According to the link, the operation will either write completely or fail.

    With that in mind, write atomically on another thread, and then do something like this!

    while (![[FileManager defaultFileManager] fileExistsAtPath:yourEventualDBPath]) {
    
    [NSThread sleepForTimeInterval:.5];
    
    }
    
    0 讨论(0)
提交回复
热议问题