2

I'm kinda lost here and I would appreciate if someone would clear things.. My need is to synchronize the content in my app with the content on the server and I have a working Core Data model.

I understand the following:

-The best way to synchronize data on the web with an iPhone is using JSON.

-CoreData needs to be translated to-from JSON because CoreData don't speak web.

-Its not complicated to translate myself with this example but lidenbrock is a library for translating coreData to-from JSON.

-RestKit is integrated with CoreData and does the translation built-in.

-JSONKit is the fastest way to synchronize data

After that the question is should I use JSONKit + lidenbrock or use RestKit instead? any suggestions? did I miss something?

Thanks.

Community
  • 1
  • 1
Tomer Even
  • 4,820
  • 2
  • 30
  • 36

2 Answers2

1

Restkit works like a charm and it is bundled with JSONKit.

"RestKit provides JSON parser implementations using JSONKit, SBJSON & YAJL. The recommended parser is JSONKit (as it is known to be the fastest JSON implementation available), but you may choose whatever parser you like and they can be changed at runtime."

But Restkit does more than translating objects, it actually maps RESTful requests to actions in your Model, thus abstracting all the data handling needed after a GET, POST, DELETE request to your backend.

defvol
  • 14,392
  • 2
  • 22
  • 32
  • A nice and short tutorial on Restkit http://mobile.tutsplus.com/tutorials/iphone/restkit_ios-sdk/ – defvol Sep 01 '11 at 12:54
  • 1
    If you are working with another kind of webservices (such as SOAP) or simple JSONs go for a standalone JSONkit implementation. – defvol Sep 01 '11 at 12:58
  • I didn't choose a web service yet.. what are the differences? – Tomer Even Sep 02 '11 at 13:46
  • It depends on your backend, personally I prefer a RESTful structure. Compare a service "mysite.com/stock and mysite.com/stock/15" with "mysite.com/InStock and mysite.com/getStockItem?id=15". – defvol Sep 06 '11 at 00:15
  • Instead of focusing in the backend logic, REST is more resource-centered. – defvol Sep 06 '11 at 00:16
1

I've been playing around with Restkit and to be honest i've found alot of it overwhelming - especially given the changes to the source and documentation which means most of the tutorials are not updated for Xcode 4 (so be careful if you are following tutorials on Restkit) - there is a great on on Restkit and github though.

If all you want to do is simple sync of data objects then I would suggest lidenbrock only if you have control over the end web service - as with lidenbrock it needs a 1 to 1 mapping with the db objects and the json (i.e field names need to match) - with Reskit field names do not need to match as you can customise and provide matching options.

I was originally using SBJSON framework but i've now switched to JSONKIT (alot quicker IMO)

utlimately though I would only use Reskit if you do not have control over the end web service

(one advantage of reskit is the relationship management though)

TheTiger
  • 196
  • 4
  • 11
  • I didn't choose a web service yet.. how would you suggest to pick a web service? – Tomer Even Sep 03 '11 at 13:37
  • 1
    Many folks are using Ruby, with Sinatra and others gems for their backend web service, but I'm not much of a Ruby person. If you aren't either, take a look at [Recess](http://www.recessframework.org/). It's nice that you can configure it quickly and easily, and mostly via the web front-end. – Greg Combs Sep 03 '11 at 16:00
  • Hey @Greg Combs thanks for your comment, I tried to make a recess backend for my app but i was quite overwhelmed for i am new to web developing... do you have any links to a tutorials or iPhone backend examples for using recess as backend? thanks – Tomer Even Sep 16 '11 at 22:25