I have invalidated my NSURLSession object but the NSURLSessionConfiguration object still has not called dealloced.
Below is the main code
{
NSURLSessionConfiguration* sessionConfig = [NSURLSessionConfiguration ephemeralSessionConfiguration];
sessionConfig.timeoutIntervalForRequest = 2.0f;
sessionConfig.timeoutIntervalForResource = 2.0f;
NSURLSession* session = [NSURLSession sessionWithConfiguration:sessionConfig];
NSMutableURLRequest* request = [self requestURLString:URLString databody:nil requestMethod:@"GET" isjson:true];
NSURLSessionDataTask* dataTask = [urlSession dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
NSInteger responseCode = [(NSHTTPURLResponse*)response statusCode];
if (error || responseCode != 200) {
failure(data,response,error,responseCode);
} else {
NSError *jsonError;
id JSON = [NSJSONSerialization
JSONObjectWithData:data
options:NSJSONReadingAllowFragments
error:&jsonError];
if (!jsonError) {
success(JSON,response,error);
} else {
failure(data,response,error,responseCode);
}
}
}];
[dataTask resume];
[urlSession finishTasksAndInvalidate];
}
I have created a class extension for NSURLSessionConfiguration and NSURLSession that overrides dealloc is called, however it is not being called.
@interface NSURLSessionConfiguration(test)
-(void)dealloc;
@end
@implementation NSURLSessionConfiguration(test)
-(void)dealloc{
NSLog(@"zzzzzzzz NSURLSessionConfiguration deallocated");
}
@end
@interface NSURLSession(test)
-(void)dealloc;
@end
@implementation NSURLSession(test)
-(void)dealloc{
NSLog(@"zzzzzzzz NSURLSession deallocated");
}
@end
UPDATE*
apprently because i have
@interface NSURLSession(test)
-(void)dealloc;
@end
@implementation NSURLSession(test)
-(void)dealloc{
NSLog(@"zzzzzzzz NSURLSession deallocated");
}
@end
The NSURLSession dealloc seems to be overriding the NSURLSessionConfiguraiton dealloc. Does anyone know why?