生成Objective-c客户端代码以使用Rest服务 [英] Generating Objective-c client side code for consuming Rest Services

查看:144
本文介绍了生成Objective-c客户端代码以使用Rest服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个使用外部服务器存储大部分数据的iPhone应用程序。服务器使用REST API公开所有必需的服务。

I am working on building an iPhone application that uses an external server to store most of the data. The server exposes all the required services using a REST API.

理想情况下,我想在objective-c中生成可以使用这些服务的客户端代码。最好这些应该返回我可以轻松使用的对象,而不必解析返回的XML。

Ideally I would like to generate the client side code in objective-c that can consume these services. Preferably these should return objects that I can easily use instead of having to parse the return XML.

我在看什么选项?我已经对此进行了一些研究,并且与我见过的代码生成最接近的是 wsdl2objc 。由于我也拥有后端服务,我可以使它们成为基于SOAP的服务,但我真的不愿意这样做,因为我稍后会使用相同的服务集来构建Web UI(例如)。我有的其他选择是使用 RestKit

What options am I looking at ? I have researched quiet a bit on this and the closest to code generation I have seen is wsdl2objc . Since I also own the backend services I could make them SOAP based services, but I really prefer not to do that since I will later on use the same set of services to build a Web UI ( for eg). Other option I have is to go with RestKit.

对此非常感谢。我很确定这是一个很多人面临的用例,我只是找不到合适的资源或者没有找到合适的地方。

Any guidance on this is much appreciated. I am pretty sure this is a use case lots of people have faced and I just am not able to find the right resources or am not looking at the right places.

干杯!!!

推荐答案

RestKit是一个很棒的框架。您仍然需要编写代码,但它将使Cocoa模型和RESTful / JSON Web服务之间的数据移动过程变得非常简单。我建议您通过这些示例来了解他们的工作方式。

RestKit is a great framework. You're still going to have to write code, but it will make the process of moving data between Cocoa models and RESTful/JSON web services elegantly straightforward. I recommend running through the examples to get your head around their way of doing things.

这篇关于生成Objective-c客户端代码以使用Rest服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆