Objective-C: Best way to access REST API on your iphone

前端 未结 5 1135
清酒与你
清酒与你 2020-11-27 10:58

been wrestling with this for some time. I am trying to access a REST api on my iphone and came across the ASIHTTP framework that would assist me. So i did something like

5条回答
  •  有刺的猬
    2020-11-27 11:47

    I'm new to iOS development and I've been battling with some of the big frameworks listed on this page for the past month or so. It has been a nightmare. I'd honestly recommend you just stick to the basics and do it yourself using AFNetworking or Apple's own NSURLConnection.

    One of the libraries listed is no longer maintained. Another underwent huge code-breaking API changes recently and now half of the tutorials describing its use no longer work. Others are massively bloated.

    It's easier than you'd think. Some resources that helped me:

    • http://blog.strikeiron.com/bid/63338/Integrate-a-REST-API-into-an-iPhone-App-in-less-than-15-minutes
    • http://www.slideshare.net/gillygize/connecting-to-a-rest-api-in-ios

    The examples on the AFNetworking homepage alone may get you 80% of the way there.

    UPDATE: The Mantle Framework (open sourced by Github Inc.) is well-designed and easy to use. It handles object mapping: converting a JSON NSDictionary to your own custom Objective-C model classes. It handles default cases sensibly and it's pretty easy to roll your own value transformers, e.g. from string to NSURL or string to your custom enum.

提交回复
热议问题