Tariq
Tariq

Reputation: 9979

Core Data Sync in existing online App

Developed one of the large scale app with several versions on Appstore. I have used AfNetworking as a networking framework. So far everything is online like i make asynchronous API calls and load data and display error if internet is not available.

Now we're planning to turn whole app to support offline caching mode.

I am trying to avoid boilerplate and lot of unnecessary code and looking for any library which can handle very complex app. I have almost finalized RestKit as I have prepared couple of samples and it seems to be syncing properly.

I am not able to convince myself 100% with only samples as I have to remove tons of AFNetworking code, API calls and parsing to replace with RestKit.

I need suggestion whether my approach is proper and keeping in mind of pros and cons of RestKit whether i should be able to implement complete offline sync app using RestKit ?

OR

I should stay with AFNetworking code and build something from scratch. If you prefer this approach then do you have some suggestions how to start ?

Upvotes: 2

Views: 332

Answers (2)

Alexander Kukla
Alexander Kukla

Reputation: 240

If you started with AFNetworking best solution for you would be MagicalRecord. Here usage example for this approach: https://github.com/keencode/AFN-Magical-Record-Example

Upvotes: 2

Wain
Wain

Reputation: 119031

RestKit is (currently) built on top of AFNetworking so you can use both at the same time. The benefit of RestKit really is that it can map your data straight into Core Data and give you very easy offline capability.

Your main issue is that neither framework provides any mechanism to determine what has changed while offline and upload those changes, you will need to develop a scheme to do that yourself.

So, if you already have mapping code around AFN and put that into Core Data, RestKit isn't going to offer you a great deal at this point in time. It really depends on your future expectations and how much additional mapping you will need to do. With RestKit you should never need to write any explicit mapping code in the future, leaving you to concentrate on your actual business logic.

Upvotes: 5

Related Questions