loadObjectsAtResourcePath(RestKit)
我有一个这样的方法。
- (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 函数吗?
I have a method like this.
- (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];
}
I get an error that says:
instance method '-loadObjectsAtResourcePath:objectClass:delegate' not found('return types default to 'id' ').
Can someone please help me how to call loadObjectsAtResourcePath function?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
也许您想手动定义映射。然后只需执行以下操作:
不要忘记将基本资源路径设置为 RKObjectManager 单例。
Maybe you want to define the mapping manually. Then just do something like this:
Don't forget to set base resource path to your RKObjectManager singleton.
我必须使用其中包含 objectMapping 的原型,因为我试图将响应映射到我自己的名为 Data 的映射。
所以我创建了一个 RKObjectMapping 对象,配置到我自己的映射类,然后使用这个函数。
它成功了!
I had to use the prototype that has objectMapping in it because i was trying to map the response to my own mapping called Data.
So i created an RKObjectMapping object ,configured to my own mapping class and then used this function.
It worked!
不知道 RestKit 这听起来像是一个简单的标头问题。查看定义“RKObjectManager”的标头。 (在 XCode 中单击它以确保它在您的项目中可用。)仔细检查方法定义并确保您正确调用它。始终使用自动完成来调用方法。
Without knowing RestKit This sounds like a simple header problem. look at the header where "RKObjectManager" is defined. (Cmd click it in XCode to make sure it's available in your project.) Double check the method definition and make sure you're calling it correctly. Always use auto-complete to invoke methods.
您的对象/类是否在接口中实现了?
Is your object/class implementing the in the interface?