I have a problem with switching controllers in a RestKit callback. This causes an error:
*** -[RKObjectLoader onDidFailWithError]: message sent to deallocated instance 0x1ddd9680
I move on to the method - (void)objectLoader:(RKObjectLoader *)objectLoader didFailWithError:(NSError *)error with this code:
[[[[RKObjectManager sharedManager] client] requestQueue] cancelAllRequests]; scAppDelegate *appDelegate = (scAppDelegate *)[UIApplication sharedApplication].delegate; WelcomeController *controller = [[WelcomeController alloc] init]; [controller createWelcome]; appDelegate.window.rootViewController = controller; [appDelegate.window addSubview:[controller view]]; [appDelegate.window makeKeyAndVisible];
My problem is in the first line, because it does not cancel the RestKit processing. In the logs, I see some ObjectMapping operations, and they cause an EXC_BAD_ACCESS (SIGSEGV) error. I found a workaround - a controller controller after a delay (using performSelector:withObject:afterDelay ). But I'm looking for a better solution.
ObjectMapping operations are:
2012-09-26 14:50:09.408 dr[5004:907] W restkit.object_mapping:RKObjectMapper.m:87 Adding mapping error: Could not find an object mapping for keyPath: '' 2012-09-26 14:50:09.410 dr[5004:907] E restkit.network:RKObjectLoader.m:231 Encountered errors during mapping: Could not find an object mapping for keyPath: '' 2012-09-26 14:50:09.411 dr[5004:907] E restkit.network:RKObjectLoader.m:360 Encountered an error while attempting to map server side errors from payload: Could not find an object mapping for keyPath: '' 2012-09-26 14:50:09.419 dr[5004:907] I restkit.support:RKCache.m:189 Invalidating cache at path: /var/mobile/Applications/1B9919DC-0674-494D-9C26-F1FC1925E856/Library/Caches/RKClientRequestCache-dr.cloudapp.net/SessionStore 2012-09-26 14:50:09.422 dr[5004:907] I restkit.network.reachability:RKReachabilityObserver.m:123 Reachability observer initialized with IP address: 0.0.0.0.
I am using the latest version of RestKit.
source share