Asynchronously posting all notifications by dispatching to main
This commit is contained in:
parent
7b685fe35e
commit
a9b9ebee37
2 changed files with 7 additions and 2 deletions
|
|
@ -301,7 +301,9 @@ static void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused targ
|
||||||
block(status);
|
block(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInteger:status] forKey:AFNetworkingReachabilityNotificationStatusItem]];
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInteger:status] forKey:AFNetworkingReachabilityNotificationStatusItem]];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static const void * AFNetworkReachabilityRetainCallback(const void *info) {
|
static const void * AFNetworkReachabilityRetainCallback(const void *info) {
|
||||||
|
|
|
||||||
|
|
@ -385,7 +385,10 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
|
||||||
|
|
||||||
if ([self isExecuting]) {
|
if ([self isExecuting]) {
|
||||||
[self.connection performSelector:@selector(cancel) onThread:[[self class] networkRequestThread] withObject:nil waitUntilDone:NO modes:[self.runLoopModes allObjects]];
|
[self.connection performSelector:@selector(cancel) onThread:[[self class] networkRequestThread] withObject:nil waitUntilDone:NO modes:[self.runLoopModes allObjects]];
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidFinishNotification object:self];
|
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidFinishNotification object:self];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
self.state = AFOperationPausedState;
|
self.state = AFOperationPausedState;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue