I am making an online/offline ios app using Restkit but i don't know to synchronise after an offline period.
I was thinking of this :
My problem is that my GET request, doesn't wait the end of GET requests to be send, so i got old datas (Datas not modified).
What do you think of this? Did you find a better way to do that?
I realize this is late, but I have recently been searching for a good way to do this.
I am currently using a method from the AFHTTPClient
class called setReachabilityStatusChangeBlock:(void (^)(AFNetworkReachabilityStatus status))block
. In my AppDelegate where I setup my Restkit objectManager, I am running this method on my AFHTTPClient object. Within the method, I have an if statement that checks for network reachability. If it is not reachable, I save the current date in my AppDelegate. If it is reachable, and self.offline != nil, then you know that you just came back online.
At this point you should be able to check the 'updatedAt' fields on your entities (with NSPredicates) to see if they have been updated or created later than the last time you went offline. Then you can PUT/POST accordingly.