Generating Objective-c client side code for consuming Rest Services

青春壹個敷衍的年華 提交于 2020-01-10 19:42:28

问题


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.

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.

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.

Cheers !!!


回答1:


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.




回答2:


Agreed with using ResKit, which allows not only to ease REST services consuming, but also mapping to CoreData and others if I remember well.

And about CoreData I would suggest using Mogenerator that intended to generate CoreData code, but it is also allowing more, since it can basically be used as a template based code generator from CoreData Models...

A good match to your question could be some Mo' templates filling the gap between both.



来源:https://stackoverflow.com/questions/5585448/generating-objective-c-client-side-code-for-consuming-rest-services

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!