loadObjectsAtResourcePath(RestKit)

发布于 2024-12-16 16:19:01 字数 524 浏览 1 评论 0原文

我有一个这样的方法。

- (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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

逐鹿 2024-12-23 16:19:01

也许您想手动定义映射。然后只需执行以下操作:

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 单例。

Maybe you want to define the mapping manually. Then just do something like this:

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];

Don't forget to set base resource path to your RKObjectManager singleton.

神妖 2024-12-23 16:19:01

我必须使用其中包含 objectMapping 的原型,因为我试图将响应映射到我自己的名为 Data 的映射。
所以我创建了一个 RKObjectMapping 对象,配置到我自己的映射类,然后使用这个函数。

    RKObjectMapping* mapping = [RKObjectMapping mappingForClass:[Data class]];
    RKObjectManager* manager = [RKObjectManager objectManagerWithBaseURL:@"http://localhost:8080/activiti-rest/service"];  
   [manager loadObjectsAtResourcePath:@"/process-definitions?start=0&size=10&sort=id&order=asc" objectMapping:mapping delegate:self]  ;

它成功了!

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.

    RKObjectMapping* mapping = [RKObjectMapping mappingForClass:[Data class]];
    RKObjectManager* manager = [RKObjectManager objectManagerWithBaseURL:@"http://localhost:8080/activiti-rest/service"];  
   [manager loadObjectsAtResourcePath:@"/process-definitions?start=0&size=10&sort=id&order=asc" objectMapping:mapping delegate:self]  ;

It worked!

翻身的咸鱼 2024-12-23 16:19:01

不知道 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.

也只是曾经 2024-12-23 16:19:01

您的对象/类是否在接口中实现了?

Is your object/class implementing the in the interface?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文