我有这样的方法。
- (void)loadData {
RKObjectManager* manager = [RKObjectManager objectManagerWithBaseURL:@"http://localhost:8080/activiti-rest/service"];
[manager loadObjectsAtResourcePath:@"/process-definitions?start=0&size=10&sort=id&order=asc" objectClass:[Data class] delegate:self];
}
我收到一条错误消息:
找不到实例方法'-loadObjectsAtResourcePath:objectClass:delegate'('返回类型默认为'id'')。
有人可以帮我如何调用loadObjectsAtResourcePath函数吗?
最佳答案
也许您想手动定义映射。然后只需执行以下操作:
RKObjectMapping *mapping = [[[RKObjectManager sharedManager] mappingProvider] objectMappingForClass:[Data class]];
RKObjectLoader *loader = [[RKObjectManager sharedManager] loadObjectsAtResourcePath:@"/process-definitions?start=0&size=10&sort=id&order=asc" objectMapping:mapping delegate:self];
不要忘记为RKObjectManager单例设置基本资源路径。
关于objective-c - loadObjectsAtResourcePath(RestKit),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8141466/