Hello i am facing a Small Problem with usurlsession.
here is my code
NSURLSessionConfiguration *defaultConfigObject = [NSURLSessionConfiguration defaultSessionConfiguration];
NSURLSession *defaultSession = [NSURLSession sessionWithConfiguration: defaultConfigObject delegate: self delegateQueue: [NSOperationQueue mainQueue]];
NSURLSessionDataTask * dataTask = [_defaultSession dataTaskWithURL:url
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if(error == nil)
{
NSString * text = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];
NSLog(@"Data = %@",text);
[self.delegate networkconnectionThreadstatus:self.ResponseStr withdata:Responsedata];
}
}];
[dataTask resume];
This works fine if i use this in UIViewController Class but i am trying to use in NSObject class and getting this error this "Sending 'networkConnection *const __strong' to parameter of incompatible type 'id _Nullable', on Delegate :self
Can Someome please help me to resolve this , i am very new to this . Thanks you .