这些类别是一套扩展,旨在帮助您使您的网络代码更具有面向对象。
希望这帮到您;(
请参阅 示例文件。
// Load our mapping info.
NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"modelMapping" ofType:@"plist"];
NSDictionary* dict = [NSDictionary dictionaryWithContentsOfFile:plistPath];
[objectManager loadMappingsFromDictionary:dict];
// GET Objects
RKTUserStatus* userStatus = [[RKTUserStatus alloc] init];
[userStatus setUsername:@"RestKit"];
[objectManager getObject:userStatus
path:nil
parameters:nil
success:successBlock
failure:errorBlock];
// POST a tweet
RKTweet* tweet = [_tweets lastObject];
RKObjectManager *objectManager = [RKObjectManager sharedManager];
[objectManager postObject:tweet
path:nil
parameters:nil
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
// This will fail, it is only here
// to demonstrate that we can easily post an object
// and the reverse mapping is resolved by the extension.
}];
本项目按照 MIT 许可证条款授权。请参阅 LICENSE 文件以获取详细信息。
RestKit-InExtensions 是由 Indeba Team 提供。