dispatches network request start / end notifications asynchronously

Signed-off-by: Mattt Thompson <m@mattt.me>
This commit is contained in:
Evadne Wu 2012-12-27 12:19:13 -05:00 committed by Mattt Thompson
parent 732cd2da02
commit 7b685fe35e

View file

@ -332,6 +332,7 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
[self didChangeValueForKey:oldStateKey]; [self didChangeValueForKey:oldStateKey];
[self didChangeValueForKey:newStateKey]; [self didChangeValueForKey:newStateKey];
dispatch_async(dispatch_get_main_queue(), ^{
switch (state) { switch (state) {
case AFOperationExecutingState: case AFOperationExecutingState:
[[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidStartNotification object:self]; [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidStartNotification object:self];
@ -342,6 +343,7 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat
default: default:
break; break;
} }
});
} }
[self.lock unlock]; [self.lock unlock];
} }