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 37
37
return request;
38
38
}
39
39
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
+
40
58
@implementation AFNetworkActivityLogger
41
59
42
60
+ (instancetype )sharedLogger {
@@ -118,7 +136,7 @@ - (void)networkRequestDidStart:(NSNotification *)notification {
118
136
- (void )networkRequestDidFinish : (NSNotification *)notification {
119
137
NSURLRequest *request = AFNetworkRequestFromNotification (notification);
120
138
NSURLResponse *response = [notification.object response ];
121
- NSError *error = [ notification.object error ] ;
139
+ NSError *error = AFNetworkErrorFromNotification ( notification) ;
122
140
123
141
if (!request && !response) {
124
142
return ;
You can’t perform that action at this time.
0 commit comments