iOS:RestKit对象管理器
我有以下方法:iOS:RestKit对象管理器,ios,restkit,Ios,Restkit,我有以下方法: - (void)httpGET:(NSString*)resourcePath withParameter:(NSDictionary*)params withRequestID:(RequestID)requestID { if ([RKClient sharedClient] == nil) [RHCHTTPController initRKSharedClient]; RKURL *url = [RKURL URLWithBaseURLString:BaseURL
- (void)httpGET:(NSString*)resourcePath withParameter:(NSDictionary*)params withRequestID:(RequestID)requestID {
if ([RKClient sharedClient] == nil)
[RHCHTTPController initRKSharedClient];
RKURL *url = [RKURL URLWithBaseURLString:BaseURL resourcePath:resourcePath queryParameters:params];
[[RKClient sharedClient] get:[url absoluteString] usingBlock:^(RKRequest *request) {
NSLog(@"Request: %@", [url absoluteString]);
request.onDidLoadResponse = ^(RKResponse *response) {
[self.delegate responseArrivedWithRKResponse:response withRequestID:requestID];
};
request.onDidFailLoadWithError = ^(NSError *error) {
[self.delegate requestDidFailWithRequestID:requestID andError:error];
};
}];
}
发送get请求。那么,如何使用RKObjectManager映射JSON响应呢
Maik你看起来有点深沉 研究如何使用“loadObjectsAtResourcePath”调用之一。或者可能是一个“getObject”调用,这两个调用都是RKObjectManager的一部分 另外,RestKit的单元测试中提供了一个关于如何使用这些调用的优秀资源。非常有用