Manos Chorianopoulos

possible fix for AFURLSessionManager

......@@ -196,10 +196,24 @@ didCompleteWithError:(NSError *)error
//Performance Improvement from #2672
NSData *data = nil;
if (self.mutableData) {
data = [self.mutableData copy];
//We no longer need the reference, so nil it out to gain back some memory.
self.mutableData = nil;
// if (self.mutableData) {
// data = [self.mutableData copy];
// //We no longer need the reference, so nil it out to gain back some memory.
// self.mutableData = nil;
// }
@try {
if (self.mutableData) {
data = [self.mutableData copy];
//We no longer need the reference, so nil it out to gain back some memory.
self.mutableData = nil;
}
}
@catch (NSException *exception) {
NSLog(@"delegate URLSession inner error: %@", exception.reason);
}
@finally {
// NSLog(@"Finally condition");
}
if (self.downloadFileURL) {
......@@ -1050,7 +1064,16 @@ didCompleteWithError:(NSError *)error
// delegate may be nil when completing a task in the background
if (delegate) {
[delegate URLSession:session task:task didCompleteWithError:error];
// [delegate URLSession:session task:task didCompleteWithError:error];
@try {
[delegate URLSession:session task:task didCompleteWithError:error];
}
@catch (NSException *exception) {
NSLog(@"delegate URLSession error: %@", exception.reason);
}
@finally {
// NSLog(@"Finally condition");
}
[self removeDelegateForTask:task];
}
......