So I have a strange problem and I'm not sure what is happening here. When the app first loads it requests the objects and maps them just fine. On reload or launching the app again RestKit appears to only be returning the original mapped objects on app load, If I delete the app and build again all original objects and any new ones are returned.
I have tested with curl by adding new objects after the initial app load. So say if when I loaded the app with 5 objects, then I add 2 more the call with curl to the same service will be correct with 7 objects returned, while Restkit is still only returning 5 in the app.
Currently I'm using this method, could it be something to do with my managed contexts? Any help would be useful.
RKManagedObjectRequestOperation *operation = [[RKObjectManager sharedManager] managedObjectRequestOperationWithRequest:request
managedObjectContext:[RKObjectManager sharedManager].managedObjectStore.mainQueueManagedObjectContext
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
// Create dictionary to pass as userinfo with returned object
NSDictionary *userInfo = [[NSDictionary alloc] initWithObjects:@[mappingResult] forKeys:@[ OBJECT_FROM_SERVER ]];
[[NSNotificationCenter defaultCenter] postNotificationName:notificationName object:nil userInfo:userInfo];
}
failure:^(RKObjectRequestOperation *operation, NSError *error) {
}];
EDIT: I should also add that server logs confirm that Restkit is not hitting the server after initial app load, but it is calling the same method to fetch the results.
Edit2: Ok so I noticed something very strange, not sure if this is expected behaviour. As I stated below after the first contact of my webservice RestKit doesn't even bother with the webservice, but rather pulls data from core data using the quoted method. Using any getObjects method actually contacts the server every time? Is this expected behaviour?? The docs sure don't reflect that unless I missed something.
Server: Apache-Coyote/1.1
Cache-Control: public, max-age=86400
Content-Type: application/json
Content-Length: 1629
Date: Sun, 20 Oct 2013 22:43:20 GMT