【问题标题】:iOS Swift NSCoreDataCoreSpotlightDelegate crash: "Can't add store"iOS Swift NSCoreDataCoreSpotlightDelegate 崩溃:“无法添加商店”
【发布时间】:2020-05-22 13:09:27
【问题描述】:

我们使用 Core Data 和 Core Spotlight 集成。非常零星的 Crashlytics 发送有关崩溃的错误报告 NSInvalidArgumentException 读取为“无法添加存储”。我们在开发和测试期间都没有遇到过这个问题。我们已经像这样配置了 Core Data 和 Spotlight:

let mom = NSManagedObjectModel(contentsOf: modelURL)

let container = NSPersistentContainer(name: "DataModel", managedObjectModel: mom!)
container.persistentStoreDescriptions = [NSPersistentStoreDescription(url: storeURL)]
if let persistentStoreDesc = container.persistentStoreDescriptions.first {
   persistentStoreDesc.shouldInferMappingModelAutomatically = false
   persistentStoreDesc.shouldMigrateStoreAutomatically = false
   persistentStoreDesc.type = NSSQLiteStoreType
   let spotlightDelegate = CoreDataCoreSpotlightDelegate(forStoreWith: persistentStoreDesc, model: container.managedObjectModel)
   persistentStoreDesc.setOption(spotlightDelegate, forKey: NSCoreDataCoreSpotlightExporter)
}  

我在网上搜索了一个有同样问题的人https://forums.developer.apple.com/thread/115897

你们中有人遇到过同样的问题并知道解决方案吗?

上次发生的时间是: 操作系统版本:12.0.1 (16A404) 设备:iPad Air 2

【问题讨论】:

    标签: ios core-data corespotlight


    【解决方案1】:

    这是我不久前的帖子 - 抱歉,我应该跟进它!我与 WWDC 的一位工程师交谈,他告诉我它已在 iOS 13 中修复。事实上,我们还没有看到任何 13 变体上的崩溃。据我所知,iOS 的早期版本没有解决方法。很抱歉成为坏消息的承担者。

    【讨论】:

      猜你喜欢
      • 2018-03-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-17
      • 1970-01-01
      • 2017-10-11
      • 2015-04-30
      相关资源
      最近更新 更多