문제

예를 들어 고객의 내용을 어떻게 인쇄합니까?

예를 들어 엔티티 데이터는 다음과 같이 인쇄해야합니다.

이름 | 성 | 전화 번호 | 이메일 | DOB

또한 데이터를 인쇄하기 전에 검색 술어를 적용해야합니다. 예를 들어 1984 년 이후에 태어난 인쇄 회원

아무도 내가 어떻게 해야하는지 말해 줄 수 있습니까?

감사!

도움이 되었습니까?

해결책

핵심 데이터를 사용하는 데 도움이되는이 링크를 찾았습니다.http://iphoneinaction.manning.com/iphone_in_action/2009/09/core-data-part-3-retrieving-data.html

엔티티를 배열로 캐스팅하고 배열을 반복하고 각 결과에 대한 데이터를 NSLOG로 표시하십시오. 예 :

NSEntityDescription *entity = [NSEntityDescription entityForName:@"news" 
                                          inManagedObjectContext:self.managedObjectContext];
[fetchRequest setEntity:entity];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"url=%@",theUrl];
[fetchRequest setPredicate:predicate];

NSError *error;
NSArray *items = [self.managedObjectContext
                   executeFetchRequest:fetchRequest error:&error];

for (news *theNews in items) {
    NSLog(@"Title: %@, Date: %@, News: %@", [theNews title], [theNews date], [theNews news]);
}

[fetchRequest release];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top