I am currently working on Parse integration for one of my iOS applications where in I need to pull some records (Customer Feedback from existing table) from Parse and show them in mob-app.With Parse iOS SDK 1.6.1 I realized that I could also use LocalDataStore to provide include the offline support, however going through the following articles appCoda , raywenderlich and Parse documents I could not figure out a solution which could solve the use case I am dealing with.
Step 1: Show all records pulling from server (Initially Sync - but I also realized that I need to enable [Parse enableLocalDatastore];
which is now interfering with initial data pull )
Step 2: Allow user to perform certain modification and sync this data back with server.
Step 3:Keep the local data store in sync with online data all the time (provided I have internet as and when needed).
I was able to implement the ALL-ONLINE version of the app and achieve all features as needed but I would also like to include the Offline support. A few question that raises doubt are
[query fromLocalDatastore];
doesn't return anything on first call (I know because there isn't anything on device). Do I need to write the logic to pull down data from backend every time and keep local datastore in sync ?)Can someone correct me if I am using it the wrong way? or give me some pointers for correct usage, then it will be really helpful.
Yes, you have to query the data online first(without "[query fromLocalDatastore];"). And "pin' it for local usage. Usefull hint can be to use "UpdatedAt" to get only the new stuff.
Once done, you can get data online and offline. The sync should be automatic.
'Red flag' : Don't forget to update to sdk 1.6.2, as they solve a lot of big bugs related to LocalDataStore.