내 coredata 저장소에 내 응용 프로그램에 대한 복구 유형으로 데이터가 있는지 tryng 오전. 기본적으로 사용자가 최종 뷰에있는 경우 지속적으로 업데이트하는 일부 데이터가 coredata에 있습니다.Coredata 오류 setObjectForKey : 개체가 없습니다 수 없습니다
그래서 최종 뷰에서 앱이 고장 나거나 잠자기 상태가되면 앱이 메모리에서 삭제됩니다.
앱이 다음에로드 될 때마다 값이 있는지 확인하기 위해 내 coredata 개체를 확인합니다. 사용자에게 미완성 된 작업이 있다는 메시지가 표시되면 계속 신선한 상태에서 중단하고 싶습니다.
내가 신선한 것을 시작하려면 현재 내 핵심 데이터에있는 모든 것을 덤프하고 작동하도록 허용하십시오. 그렇지 않으면 마지막 뷰로 넘어 가서 데이터를로드하고 작업을 계속할 수있게됩니다.
그러나 이것은 오류가 발생하는 곳이므로 내 coredata를 확인합니다.
NSMutableArray *checkFinMutableArray = [coreDataController readFin];
if ([checkFinMutableArray count] > 0) {
//Show mesage, recover or not?
UIAlertView *alert = [[UIAlertView alloc] init];
[alert setTitle:@"Selected projects avalible"];
[alert setMessage:@"It appears that you have unfinished projects from a previous session. Would you like to continue working on these projects?"];
[alert setDelegate:self];
[alert addButtonWithTitle:@"Yes"];
[alert addButtonWithTitle:@"No"];
[alert show];
}
이 내 coredata 객체가
- (NSMutableArray *)readFinDimensions {
NSManagedObjectContext *context = [self managedObjectContext];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Project" inManagedObjectContext:context];
[fetchRequest setEntity:entity];
NSError *error;
NSMutableArray *projectDictionaryArray = [[NSMutableArray alloc] init];
NSArray *fetchedObjects = [context executeFetchRequest:fetchRequest error:&error];
for (ProjectList *projectList in fetchedObjects) {
NSMutableDictionary *tempProjectDictionaryArray = [[ NSMutableDictionary alloc] init];
[tempProjectDictionaryArray setObject:project.proj forKey:@"Proj"]; // this is where the ap dies
[tempProjectDictionaryArray setObject:project.desc forKey:@"Desc"];
[projectDictionaryArray addObject:tempProjectDictionaryArray];
}
return projectDictionaryArray;
}
처럼 보이는이 어떤 도움을 크게 감상 할 수
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** setObjectForKey: object cannot be nil (key: Proj)'
같은 오류가 모습입니다 것입니다. 사용자가 예를 들어 확인해야하므로
project.proj
이 값으로
[tempProjectDictionaryArray setObject:project.proj forKey:@"Proj"];
NS(Mutable)Dictionary
못해 저장소 nil
에서 nil
것을 의미
project.proj가 포함 된 항목은 무엇입니까? 오류가 없다고 말할 수 있습니까? – RFG
엔티티 이름이 잘못되었습니다.'NSEntityDescription'을 만들 때'@ "Project"'를 사용하고 있습니다. 'ProjectList' 여야합니다. – TheTiger