iOS 10 核心数据异常代码错误 : (6922)

标签 ios sqlite core-data swift3 core-data-migration

尝试在 iOS 10 上迁移核心数据时,我们的 SQL 数据库出现异常。抛出了异常,但似乎迁移仍然成功。我们进行手动迁移,然后 MagicalRecord 处理其余的设置。之前有没有其他人经历过/知道如何解决这个问题?

错误输出:

    CoreData: error: (6922) I/O error for database at /var/mobile/Containers/Data/Application/9CA333FB-49CB-4168-B26A-A6F6E6CF94C7/Documents/Messaging.sqlite.  SQLite error code:6922, 'disk I/O error'
CoreData: error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///var/mobile/Containers/Data/Application/9CA333FB-49CB-4168-B26A-A6F6E6CF94C7/Documents/Messaging.sqlite options:{
NSInferMappingModelAutomaticallyOption = 1;
NSMigratePersistentStoresAutomaticallyOption = 1;
NSSQLitePragmasOption =     {
    "journal_mode" = WAL;
};
} ... returned error Error Domain=NSCocoaErrorDomain Code=256 "The file couldn't be opened." UserInfo={NSSQLiteErrorDomain=6922, NSUnderlyingException=I/O error for database at /var/mobile/Containers/Data/Application/9CA333FB-49CB-4168-B26A-A6F6E6CF94C7/Documents/Messaging.sqlite.  SQLite error code:6922, 'disk I/O error'} with userInfo dictionary {
NSSQLiteErrorDomain = 6922;
NSUnderlyingException = "I/O error for database at /var/mobile/Containers/Data/Application/9CA333FB-49CB-4168-B26A-A6F6E6CF94C7/Documents/Messaging.sqlite.  SQLite error code:6922, 'disk I/O error'";
}
CoreData: error: Illegal attempt to save to a file that was never opened.  "This NSPersistentStoreCoordinator has no persistent stores (I/O error).  It cannot perform a save operation.".  Last recorded error = Error Domain=NSCocoaErrorDomain Code=256 "The file "Messaging.sqlite" couldn't be opened." UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/9CA333FB-49CB-4168-B26A-A6F6E6CF94C7/Documents/Messaging.sqlite, NSSQLiteErrorDomain=6922} / {
NSFilePath = "/var/mobile/Containers/Data/Application/9CA333FB-49CB-4168-B26A-A6F6E6CF94C7/Documents/Messaging.sqlite";
NSSQLiteErrorDomain = 6922;
}

最佳答案

我今天升级到 Xcode 11 beta 5 后遇到了这个问题。

运行命令重置我所有的模拟器为我纠正了它:

xcrun simctl erase all

关于iOS 10 核心数据异常代码错误 : (6922),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42308361/

相关文章:

ios - 同一服务器的不同 REST 端点之间的 URLSession

SQLite3 中的 PHP JSON 数组

Python3 - 有没有一种方法可以在一个非常大的 SQlite 表上逐行迭代,而无需将整个表加载到本地内存中?

iphone - 删除旧的 Coredata 类并添加新的类会导致 iOS 崩溃

cocoa - 用于有序配对的项目使用什么数据类型?

ios - 观察 NSManagedObject 变量上的 didSet

html - iOS 新窗口滚动偏移错误

iphone - 无法使用 __bridge 将 CFStringRef 转换为 NSString

ios - 覆盖核心数据文件然后加载新文件

IOS 7 损坏的数据库