2016-02-11 68 views
0

我修改苹果的李斯特样品与UIManagedDocument而不是UIDocument工作删除UIManagedDocument。除删除文档外,一切都可以使用。当我尝试删除使用苹果公司在removeListAtURL方法的代码的文档中ListUtilites.swift它使用NSFileCoordinator我得到这个错误信息的上市文件中消失后,然后在模拟器中重新出现:无法使用NSFileCoordinator

CoreData: error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///Users/.../AppGroup/E16FD6E8-8AD6-44BB-A031-5FB497F04FD4/Documents/myList.list/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"; 

“无法添加同一商店两次“的错误对我来说没有任何意义,因为我正在删除该文件。也许我需要先关闭文件?该文件是本地的,不在iCloud中,所以我不认为我需要删除任何事务日志。此外,当我删除NSFileCoordinator代码它工作正常,只是用户NSFileManager马上能正常工作的本地文件,但我得到了同样的错误了iCloud的文件。

回答

0

我忘了先关闭文档。记住孩子们,在删除他们之前总是关闭你的文档......尤其是UIManagedDocument s。