Posts

Post marked as Apple Recommended
599 Views
Hello guys.Recently, I'm trying to add CoreSpotlight Integration to my app, and I wrote the following code:public func createDataMainContext() -> NSManagedObjectContext { let bundles = [Bundle(for: PeopleToSave.self)] guard let model = NSManagedObjectModel.mergedModel(from: bundles) else { fatalError("Model not found") } let psc = NSPersistentStoreCoordinator(managedObjectModel: model) let storeDescription = NSPersistentStoreDescription(url: storeUrl!) storeDescription.shouldMigrateStoreAutomatically = true storeDescription.shouldInferMappingModelAutomatically = true let coreDataCoreSpotlightDelegate = NSCoreDataCoreSpotlightDelegate(forStoreWith: storeDescription, model: model) storeDescription.setOption(coreDataCoreSpotlightDelegate, forKey: NSCoreDataCoreSpotlightExporter) psc.addPersistentStore(with: storeDescription) { _,_ in } let context = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType) context.persistentStoreCoordinator = psc return context }But then Xcode said that "Use of unresolved identifier 'NSCoreDataCoreSpotlightDelegate", and now I've got no idea what to do with it 😟
Posted Last updated
.