我对苹果的Lister示例进行了修改,使其可以使用UIManagedDocument而不是UIDocument。除了删除文档外,一切都正常工作。当我试图在使用removeListAtURL方法的ListUtilites.swift中删除一个使用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文件也有相同的错误。
发布于 2016-02-15 20:49:36
我忘了先关闭文件。记住孩子们,总是在删除之前关闭你的文档.特别是UIManagedDocuments.
https://stackoverflow.com/questions/35349887
复制相似问题