가져 오기 :코어 데이터가 나는이처럼 보이는 데이터 모델이 요청
나는 사용자가 고객을 선택하는있는 tableview에 고객의 목록이 표시를, 그 다음 객실의 목록을 보여줍니다 그 고객 -이 모든 것이 현재 잘 작동합니다.
내가보기에 문제는 방에 대한 세부 정보보기를 시도 할 때입니다. 사용자가 방을 선택하면 해당 방의 모든 값이 표시된보기가 표시됩니다. (잘해야한다). 나는 어느 정도는 작동하지만, 만약 내가 같은 두 개의 방이있다 - 즉, "침실 1", 두 명의 다른 고객을위한 다음 그것은 정확한 방 데이터를 보여주지 않습니다.
, 상세 뷰는 내가 뭘 어떻게 할AppDelegate_Shared *appDelegate = [[UIApplication sharedApplication] delegate];
NSManagedObjectContext *context = [appDelegate managedObjectContext];
NSEntityDescription *entityDesc = [NSEntityDescription entityForName:@"Rooms" inManagedObjectContext:context];
NSFetchRequest *request = [[NSFetchRequest alloc] init];
[request setEntity:entityDesc];
NSPredicate *pred = [NSPredicate predicateWithFormat:@"(Room = %@)", titleStr];
[request setPredicate:pred];
NSManagedObject *matches = nil;
NSError *error;
NSArray *objects = [context executeFetchRequest:request error:&error];
if ([objects count] == 0)
{
NSLog(@"No matches");
} else
{
matches = [objects objectAtIndex:0];
NSLog(@"matches found");
aLbl.text = [matches valueForKey:@"DimA"];
}
[request release];
[NSFetchedResultsController deleteCacheWithName:nil];
[self.fetchedResultsController.fetchRequest setPredicate:pred];
이 이미 선택되어 어떤 고객을 기반으로 세부 사항을 보여줍니다 여기
내가 사용하고있는 코드입니다.어떤 도움이 많이 감사합니다 ...
감사
[NSPredicate predicateWithFormat : @ "(Room == % @) AND (CustomerRelationship == % @)", titleStr, customerManagedObject] – zrxq
감사합니다. 활을 가져 가라 :-) –