Skip to content

Commit 1c9f3f7

Browse files
committed
Check for selector, not class when retrieving request object from AFURLSessionManager
The class of the object associated with a notification sent from AFURLSessionManager may not be NSURLSessionTask e.g. [[notification object] class] => __NSCFLocalDataTask. Check for respondsToSelector: in order to retrieve the request instead.
1 parent de8ffe7 commit 1c9f3f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

AFNetworkActivityLogger.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
NSURLRequest *request = nil;
3131
if ([[notification object] isKindOfClass:[AFURLConnectionOperation class]]) {
3232
request = [(AFURLConnectionOperation *)[notification object] request];
33-
} else if ([[notification object] isKindOfClass:[NSURLSessionTask class]]) {
34-
request = [(NSURLSessionTask *)[notification object] originalRequest];
33+
} else if ([[notification object] respondsToSelector:@selector(originalRequest)]) {
34+
request = [[notification object] originalRequest];
3535
}
3636

3737
return request;

0 commit comments

Comments
 (0)