2014-04-06 1 views
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.' 

내가 무엇을 놓쳤을 까?

+0

'addPersistentStoreWithType' 중에 '오류'가 나옵니까? 이게 뭐야? – Wain

+0

"창작"이란 무슨 뜻입니까? 오류는 내가'[NSEntityDescription insertNewObjectForEntityForName : @ "엔터티 inManagedObjectContext : managedObjectContext]; ' – r4id4

+0

실제로 내가이 코드 줄을 추가하기 전에 호출하려고 할 때마다 발생합니다. 마이그레이션 전에 핵심 데이터가 제대로 작동했는지, persistentStoreCoordinator가 전에. – r4id4

답변

0

내가 관리 할 사실, 나는 또한 options라고 불리는 NSDictionary으로 iCloud에서 데이터베이스를 처리하기 위해 생성 한 persistentStoreCoordinator를 업데이트해야했습니다.