0
xcdatamodeld
을 바꿔야하므로이 tutorial을 따라갔습니다.CoreData 라이트 마이그레이션 관련 문제.
또 다른 .mom 파일을 만들고 하나의 특성을 이전 엔티티 중 하나에 추가했습니다. 그럼 내 AppDelegate
에 이것을 설정합니다.
NSDictionary *options = @{
NSMigratePersistentStoresAutomaticallyOption : @YES,
NSInferMappingModelAutomaticallyOption : @YES
};
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&error]) ...
나는 괜찮다고 생각했지만 핵심 데이터와 상호 작용하려고 할 때 내 앱이이 오류로 중단됩니다.
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This NSPersistentStoreCoordinator has no persistent stores. It cannot perform a save operation.'
내가 무엇을 놓쳤을 까?
'addPersistentStoreWithType' 중에 '오류'가 나옵니까? 이게 뭐야? – Wain
"창작"이란 무슨 뜻입니까? 오류는 내가'[NSEntityDescription insertNewObjectForEntityForName : @ "엔터티 inManagedObjectContext : managedObjectContext]; ' – r4id4
실제로 내가이 코드 줄을 추가하기 전에 호출하려고 할 때마다 발생합니다. 마이그레이션 전에 핵심 데이터가 제대로 작동했는지, persistentStoreCoordinator가 전에. – r4id4