This repository was archived by the owner on Jan 17, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 3737 return request;
3838}
3939
40+ static NSError * AFNetworkErrorFromNotification (NSNotification *notification) {
41+ NSError *error = nil ;
42+ if ([[notification object ] isKindOfClass: [AFURLConnectionOperation class ]]) {
43+ error = [(AFURLConnectionOperation *)[notification object ] error ];
44+ }
45+
46+ #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000
47+ if ([[notification object ] isKindOfClass: [NSURLSessionTask class ]]) {
48+ error = [(NSURLSessionTask *)[notification object ] error ];
49+ if (!error) {
50+ error = notification.userInfo [AFNetworkingTaskDidCompleteErrorKey];
51+ }
52+ }
53+ #endif
54+
55+ return error;
56+ }
57+
4058@implementation AFNetworkActivityLogger
4159
4260+ (instancetype )sharedLogger {
@@ -118,7 +136,7 @@ - (void)networkRequestDidStart:(NSNotification *)notification {
118136- (void )networkRequestDidFinish : (NSNotification *)notification {
119137 NSURLRequest *request = AFNetworkRequestFromNotification (notification);
120138 NSURLResponse *response = [notification.object response ];
121- NSError *error = [ notification.object error ] ;
139+ NSError *error = AFNetworkErrorFromNotification ( notification) ;
122140
123141 if (!request && !response) {
124142 return ;
You can’t perform that action at this time.
0 commit comments