코어 데이터 엔티티를 표시하는 테이블 뷰 행에 대한 복사 및 붙여 넣기를 지원할 수 있기를 원합니다. 이 엔티티에는 하나의 속성과 두 개의 관계가 있습니다. Apple이 추천 한 사전 보관 기술 ('NSPersistentDocument Core Data Tutorial'에서)을 사용하면 관계에서 오류가 발생합니다.관계가있는 핵심 데이터 엔티티 보관
for (id sectionObject in selectedSectionsArray){
NSDictionary *thisDictionary = [sectionObject dictionaryRepresentation]; // 'sectionObject' has 1 attribute and 2 relationships (one-to-many)
[copyObjectsArray addObject:[sectionObject dictionaryRepresentation]];
}
NSPasteboard *generalPasteboard = [NSPasteboard generalPasteboard];
[generalPasteboard declareTypes:[NSArray arrayWithObjects:MSSectionsPBoardType, NSStringPboardType, nil] owner:self];
NSData *copyData = [NSKeyedArchiver archivedDataWithRootObject:copyObjectsArray]; // Here's where it crashes. ERROR MESSAGE: "-[NSManagedObject encodeWithCoder:] unrecognized selector sent to instance 0x22fd410"
따라서, 그것의 URI를 보관해야합니다 대지에 관계를 복사 할 수있는 유일한 방법을 보인다 : 여기에 문제가 발생 코드의 필수적인 부분입니다. 이 경우 임시 ID를 참조하는 데 어려움이 있습니다. 누군가이 사실을 확인해 주시겠습니까? 그렇게 열심히해야합니까?
"NSPersistentDocument 핵심 데이터 자습서"에 대한 링크를 제공 할 수 있습니까? 제목 페이지에 "권장하지 않음"이라고 표시된 Mac OS X 10.4 용 버전 만 있습니다. –