Rearrange the notifications to avoid crash during service unavailable condition. fixes #65

This commit is contained in:
Blake Watters
2011-04-22 12:06:45 -04:00
parent 16c8fff8ee
commit 2841d0ba15

View File

@@ -310,13 +310,16 @@
[_delegate request:self didLoadResponse:response];
}
NSDictionary* userInfo = [NSDictionary dictionaryWithObject:response forKey:@"response"];
[[NSNotificationCenter defaultCenter] postNotificationName:RKRequestDidLoadResponseNotification object:self userInfo:userInfo];
[[NSNotificationCenter defaultCenter] postNotificationName:RKResponseReceivedNotification object:response userInfo:nil];
if ([response isServiceUnavailable]) {
[[NSNotificationCenter defaultCenter] postNotificationName:RKServiceDidBecomeUnavailableNotification object:self];
}
NSDictionary* userInfo = [NSDictionary dictionaryWithObject:response forKey:@"response"];
[[NSNotificationCenter defaultCenter] postNotificationName:RKRequestDidLoadResponseNotification object:self userInfo:userInfo];
// NOTE: This notification must be posted last as the request queue releases the request when it
// receives the notification
[[NSNotificationCenter defaultCenter] postNotificationName:RKResponseReceivedNotification object:response userInfo:nil];
}
- (BOOL)isGET {