如果您创建了一个新文档,并且当前目录中不存在同名文件,则应用程序将冻结。特别是,open类的UIManagedDocument函数不调用其完成处理程序。
另一方面,如果文件已经存在于当前目录中,那么open函数将调用完成处理程序。但是,在这种情况下,控制台上打印了一个Core数据错误。
我正在用Xcode 10在iOS 12模拟器上进行测试。也在设备上测试。
CoreData: error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///Users/ruben/Library/Developer/CoreSimulator/Devices/####/data/Containers/Data/Application/####/tmp/mydoc.doccy/StoreContent/persistentStore options:{ NSPersistentStoreRemoveStoreOnCleanupKey = 1; } ... returned error Error Domain=NSCocoaErrorDomain Code=134080 "(null)" UserInfo={NSUnderlyingException=Can't add the same store twice} with userInfo dictionary { NSUnderlyingException = "Can't add the same store twice"; }
发布于 2018-09-27 05:29:07
在创建文档并保存到临时位置之后,您需要先调用close,然后再导入和打开它。
https://stackoverflow.com/questions/52529228
复制相似问题