In an effort to clean up my application delegate I have moved Restkit configuration (ie, starting with [RKObjectManager managerWithBaseURL:[MYAppConfig wsBaseUrl]];
) to another class MYAppConfig
in a static method +(RKObjectManager *)defaultObjectManager
.
At the very real risk of exposing my ignorance I am not sure whether this is a legitimate reorganization or could lead to trouble, mainly because I am not sure how Restkit's singleton is implemented (it seems like, based on the tutorials I have read, it gets created when you call the class method managerWithBaseURL
).
What is driving my suspicion is that RestKit's logging functions do not seem to be firing when I make a fetch request.
The whole thing now kind of goes like this:
In MYAppDelegate.m
method didFinishLaunchingWithOptions
, first line:
[self _setup]
In MYAppDelegate.m
method _setup
[self _setupORM];
RKLogConfigureByName("RestKit", RKLogLevelTrace);
RKLogConfigureByName("RestKit/ObjectMapping", RKLogLevelTrace);
RKLogConfigureByName("RestKit/Network", RKLogLevelTrace);
RKLogConfigureByName("RestKit/CoreData", RKLogLevelTrace);
In MYAppDelegate.m
method _setupORM
RKObjectManager *manager = [MYAppConfig defaultObjectManager];
NSLog(@"Setup ORM with object manager %@",[manager description]);
In MYAppConfig.m
class method defaultObjectManager
RKObjectManager *manager = [RKObjectManager managerWithBaseURL:[MYAppConfig wsBaseUrl]];
NSManagedObjectModel *managedModel = [NSManagedObjectModel mergedModelFromBundles:nil];
RKManagedObjectStore *managedStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:managedModel];
manager.managedObjectStore = managedStore;
...
[managedStore createManagedObjectContexts];
managedStore.managedObjectCache = [[RKInMemoryManagedObjectCache alloc] initWithManagedObjectContext:managedStore.persistentStoreManagedObjectContext];
return manager;
Should I look elsewhere to see why logging appears to be failing or might it have something to do with how I have structured the configuration?