업데이트 된 버전 core data update in background. 링크 Grand Central Dispatch (GCD) with CoreData의 도움으로백그라운드에서 핵심 데이터
는 배경을 만들어 managedObjectContext하지만 핵심 데이터에서 가져 오는 때 오류가 점점 오전
-(void) startTimerThread
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// Add code here to do background processing
NSManagedObjectContext *context = [[NSManagedObjectContext alloc] init];
self.backgroundManagedObjectContext = context;
[self.backgroundManagedObjectContext setPersistentStoreCoordinator:self.managedObjectContext.persistentStoreCoordinator];
self.managedObjectContext = self.backgroundManagedObjectContext;
[self getDataFromFile];
dispatch_async(dispatch_get_main_queue(), ^{
// Add code here to update the UI/send notifications based on the
// results of the background processing
[[NSNotificationCenter defaultCenter] postNotificationName:@"ReloadAppDelegateTable" object:nil];
[context release];
self.managedObjectContext = [(AppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext];
});
});
}
내 getDataFromFile
나는 점점 오전 오류
managedObjectContext
NSFetchRequest *request = [[NSFetchRequest alloc] init];
[request setPredicate:[NSPredicate predicateWithFormat:@"date == max(date)"]];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"LogDetails" inManagedObjectContext:self.managedObjectContext];
같은 오류에서
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+entityForName: could not locate an NSManagedObjectModel for entity name LogDetails
누구든지 내게 왜이 오류가 발생하는지 제안 해 줄 수 있습니까? 이전에는 같은 오류를주는 managedObjectContext 자식을 만들려고했습니다.
미리 감사드립니다.
새 질문을 게시하는 대신 업데이트하려는 내용이있는 원래 질문을 편집하십시오. – Caleb
확인. 미안 해요. 감사 – aparna