Ok so I have an application that uses core data to save while in offline mode. I can successfully push the data down to the database, however it seems that when I go to execute a fetch, none of the new data is there.Is this some kind of caching issue?Here is my restkit initialization methods- (void) initializeRestKit
{
// Retrieve the base server URL
NSString* serverName = [[Resource_Service sharedModel] getDictValue:@"ServerName"];
// RKObjectManager is our base class for any requests that involove mapping to core data
self.RestKitObjectManager = [[RKObjectManager sharedManager] init];
self.RestKitObjectManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:serverName]];
// Enable automatic network activity indicator management
[AFNetworkActivityIndicatorManager sharedManager].enabled = YES;
// Configure MIME Types
self.RestKitObjectManager.requestSerializationMIMEType = RKMIMETypeJSON;
// Configure the core data
[self configureCoreData];
// Add the routing paths
[self addRoutingPaths];
// Wire up any observers for the data
[self wireUpObservers];
}
- (void) configureCoreData
{
// Retrieve the model name
NSString* momdName = [[Resource_Service sharedModel] getDictValue:@"ManagedObjectModelName"];
// Retrieve the base SQL file Name
NSString* sqlFileName = [RKApplicationDataDirectory() stringByAppendingPathComponent:[[Resource_Service sharedModel] getDictValue:@"DataStoreFileName"]];
// Retrieve the model URL
NSURL *modelURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:momdName ofType:@"momd"]];
self.RestKitManagedObjectModel = [[[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL] mutableCopy];
self.RestKitObjectStore = nil;
self.RestKitObjectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:self.RestKitManagedObjectModel];
[self.RestKitObjectStore addSQLitePersistentStoreAtPath:sqlFileName fromSeedDatabaseAtPath:nil withConfiguration:nil options:nil error:nil];
// Create the managed object contexts
[self.RestKitObjectStore createManagedObjectContexts];
self.RestKitObjectManager.managedObjectStore = self.RestKitObjectStore;
// Configure a managed object cache to ensure we do not create duplicate objects
self.RestKitObjectManager.managedObjectStore.managedObjectCache = [[RKInMemoryManagedObjectCache alloc] initWithManagedObjectContext:self.RestKitObjectManager.managedObjectStore.persistentStoreManagedObjectContext];
}