Book
是一个普通的NSObject
,Author
而是一个NSManagedObject
,并且我正在映射Book#author
到Author
,Book.objectMapping
问题是我将一个托管对象嵌入到一个普通对象中,RestKit 是否有可能将嵌入映射author
到一个 CoreData 对象?
//Book.m
+ (RKObjectMapping *)objectMapping {
RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[Book class]];
mapping.rootKeyPath = @"book";
[mapping mapKeyPathsToAttributes:@"book_id", @"bookID",
@"author_id", @"authorID", nil];
[mapping mapKeyPath:@"author"
toRelationship:@"author"
withMapping:[Author objectMapping]];
}