Iphone Restkit RKObjectLoader error
I have created an app, for Iphone, that uses Three20 and RestKit framework.
The ap开发者_如何转开发p works almost perfectly, but there is a problem in the following situation:
I have a view that calls another using the method TTOpenURL(@"tt://reports");
In my loadView i have the method
[[RKObjectManager sharedManager] loadObjectsAtResourcePath:@"/checks" queryParams:params delegate:self];
I have those two methods for the returns:
- (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray*)objects
- (void)objectLoader:(RKObjectLoader*)objectLoader didFailWithError:(NSError*)error
Everything works correctly, the view shows the results and after i selected the back button everything keeps running correctly.
But if I open the screen and select the back button before finishing the loading,
an error occurs in the class RKObjectLoader
in the method - (void) didFinishLoad (RKResponse *) response;
most precisely in line
if ([_delegate respondsToSelector:@selector(request:didLoadResponse:)]) {
Does anyone know how can I solve this problem?
Thanks in advance.
Andre
You just need to add the following to your controller's (RKObjectLoaderDelegate's) dealloc method:
[[RKRequestQueue sharedQueue] cancelRequestsWithDelegate:self];
精彩评论