사전 응용 프로그램에서 작업하고 있습니다. 이 응용 프로그램은 핵심 데이터를 사용하고 있으며 핵심 데이터를 처음 접했습니다. 데이터베이스에서 단일 엔티티로 저장된 기록은 엔티티가 "영어"& "을 의미 을"두 속성이 및 사전 사전했다. 그래서 사용자가 some char라고 말하면, UISearchBar
에 "a"에서 시작하는 데이터베이스에서 레코드를 가져오고 싶습니다. 레코드를 가져 오려는 b보다 사용자 유형 데이터가 "ab"에서 시작하는 식이면 계속됩니다.코어 데이터에서 데이터를 가져 오는 중 오류가 발생했습니다.
나는 아래의 코드에 의해 같은 일을하려고 해요 :
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'keypath English not found in entity <NSSQLEntity TamilEnglishDict id=1>'
편집 :
이이 코드는 다음과 같은 오류 MSG 내 응용 프로그램 충돌을 실행
// Fetch the devices from persistent data store
NSManagedObjectContext *managedObjectContext = [self managedObjectContext];
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:ENTITY_NAME inManagedObjectContext:managedObjectContext];
[request setEntity:entity];
// retrive the objects with a given value for a certain property
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K beginswith[c] %@",@"English",searchText];
[request setPredicate:predicate];
// Edit the sort key as appropriate.
/*NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"English" ascending:YES];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
[request setSortDescriptors:sortDescriptors];*/
// Edit the section name key path and cache name if appropriate.
// nil for section name key path means "no sections".
/*NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:request managedObjectContext:managedObjectContext sectionNameKeyPath:nil cacheName:@"Root"];
aFetchedResultsController.delegate = self;*/
NSError *error = nil;
_searchResult = [managedObjectContext executeFetchRequest:request error:&error];
내 데이터 모델이 ...
레코드를 올바르게 가져 오는 올바른 길로 안내 할 수있는 사람은 누구입니까?
당신이 모델에 대해 뭔가를 말할 수 할 수 있을까? 엔티티에는 '영어'속성이 없습니다. –
@flexaddicted 속성 "영어"가 있습니다. 내 모델이 걱정거리 인 한 그것을 설명하려고 노력합니다 .. XML 파일이 몇 개 있는데, 파일을 구문 분석하고 데이터베이스를 만들었습니다. managedObject에서 직접 2 개의 키 "영어"와 "의미"를 가진 setValue를 사용합니다. 그게 내가 데이터베이스를 만들고 내 질문에 설명했던 방식으로 레코드를 가져 오는 방법이다. – Suryakant
모델보기. 'ENTITY_NAME'이란 무엇입니까? 가능한 경우 스크린 샷을 제공하십시오. –