2017-01-30 6 views

答えて

0

でそれをマップする必要があります。これはドキュメントの例です:

@interface RKMetadataExample : NSObject 
@property (nonatomic, copy) NSString *name; 
@property (nonatomic, copy) NSURL *URL; 
@property (nonatomic, copy) NSDate *mappedAt; 
@end 

RKMetadataExample *example = [RKMetadataExample new]; 
NSDictionary *representation = @{ @"name": @"Blake Watters" }; 
NSDictionary *metadata = @{ @"URL": [NSURL URLWithString:@"http://restkit.org"] }; 

RKObjectMapping *objectMapping = [RKObjectMapping mappingForClass:[RKMetadataExample class]]; 
[objectMapping addAttributeMappingsFromDictionary:@{ @"name": @"name", @"@metadata.URL": @"URL" }]; 

RKMappingOperation *mappingOperation = [[RKMappingOperation alloc] initWithSourceObject:representation destinationObject:example mapping:objectMapping]; 
mappingOperation.metadata = metadata; 

NSError *error = nil; 
BOOL success = [mappingOperation execute:&error]; 
関連する問題