首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用UIManagedDocument删除NSFileCoordinator

无法使用UIManagedDocument删除NSFileCoordinator
EN

Stack Overflow用户
提问于 2016-02-11 20:58:40
回答 1查看 164关注 0票数 0

我对苹果的Lister示例进行了修改,使其可以使用UIManagedDocument而不是UIDocument。除了删除文档外,一切都正常工作。当我试图在使用removeListAtURL方法的ListUtilites.swift中删除一个使用NSFileCoordinator的苹果代码时,我会在列出的文档消失后得到这个错误消息,然后在模拟器中重新显示:

代码语言:javascript
复制
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文件也有相同的错误。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-02-15 20:49:36

我忘了先关闭文件。记住孩子们,总是在删除之前关闭你的文档.特别是UIManagedDocuments.

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35349887

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档