Simple Objective-C API service23 May 2013
Posted by : Gareth Shapiro
I am sure many Objective-C developers, iOS or OSX, have been in the situation where the backend API needed for the project they are working on has not been developed by the time they need to start writing the code that will access it. In organisations such as creative agencies, startups and software companies it is not always possible to synchronise resources to perfectly suit all the current projects' timelines but with a mixture of creativity and technology, conveniently wrapped up in a utility called SimpleObjectiveCAPIService, this simple bottle neck can be negotiated.
It is only correct that I point out now that this utility has been created more to assist with iOS app development rather than provide production ready network utility. If you are developing an enterprise iPad app or an iPhone app that has to cope with dynamic connectivity situations this utility is more than likely going to fall short of your needs.
There are a few ways of solving the issue of providing a local version of an API. You could use a local web server on your machine, mock objects in your unit tests or as I was recently asked by a Technical Director while freelancing you could choose to include JSON files in the project to replicate API responses.
The advantage to this approach is the dependancies to get the local solution working are simple text files and are included in the project are backed up in Git/SVN and as such the situation can be easily replicated. Another advantage is realised when the stub files are named in a way that describe the API calls. These can then be supplied to the back end developer as part of communicating what is needed for them to produce the API, cutting down on the project documentation burden.