RSSフィードのアイテムをマッピングしようとしています。RKObjectRequestOperationはオブジェクトの正確な数を返しますが、属性値はnilです。以下は私のコードです
NSURL *requestURL = [NSURL URLWithString:@"http://sports.espn.go.com/espn/rss/nfl/news"];
[RKMIMETypeSerialization registerClass:[RKXMLReaderSerialization class] forMIMEType:@"application/rss+xml"];
RKObjectMapping *rssFeedObjectMapping = [RKObjectMapping mappingForClass:[SBRssFeed class]];
[rssFeedObjectMapping addAttributeMappingsFromDictionary:@{
@"title" : @"title",
@"link" : @"link"
}];
RKResponseDescriptor *rssFeedResponseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:rssFeedObjectMapping
pathPattern:nil
keyPath:@"rss.channel.item"
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
RKObjectRequestOperation *requestOperation = [[RKObjectRequestOperation alloc]initWithRequest:[NSURLRequest requestWithURL:requestURL]
responseDescriptors:@[rssFeedResponseDescriptor]];
[requestOperation setCompletionBlockWithSuccess:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
_datasourceArray = mappingResult.array;
NSLog(@"Count %d", _datasourceArray.count);
[self.tableView reloadData];
}
failure:^(RKObjectRequestOperation *operation, NSError *error) {
NSLog(@"Error %@", error);
}];
[requestOperation start];
見逃したことはありますか?