我正试图迁移到RestKit 0.20-pre2版本。
目前,我已经成功地迁移了我的映射(至少编译器不再抱怨),但在创建请求方面遇到问题(之前我使用的 RKObjectLoader 现在已不再存在)。
我的旧代码如下:
- (RKObjectLoader*)objectLoaderWithResourcePath: (NSString*)resourcePath
method: (RKRequestMethod)httpMethod
parameters: (NSDictionary*)parameters
mappableClass: (Class)objectClass
{
RKObjectMapping *mapping = [self.objectManager.mappingProvider objectMappingForClass:objectClass];
NSString *path = resourcePath;
if (httpMethod == RKRequestMethodGET) {
path = [resourcePath stringByAppendingQueryParameters:parameters];
}
RKObjectLoader *request = [self.objectManager loaderWithResourcePath:path];
request.method = httpMethod;
request.delegate = self;
request.objectMapping = mapping;
if (httpMethod != RKRequestMethodGET) {
request.params = parameters;
}
return request;
}
我使用以上方法创建一个通用请求,然后将其同步或异步发送。 现在...我看到了新的方法
getObjectsAtPath:parameters:success:failure:
,但是...我需要相同的POST方法(我没有任何对象要发布...只是服务器接受登录的POST请求..)。有什么帮助吗?
谢谢。