Previous code
[NSURLConnection sendSynchronousRequest:request returningResponse:&response error: NULL]; return ([response statusCode] == 200) ? YES : NO;
Code using now
+(BOOL)isConnectNetwork{
NSString *urlString = @"http://www.google.com/";
NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"HEAD"];
NSHTTPURLResponse *response;
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:
^(NSData *data, NSURLResponse *response, NSError *error) {
// ...
}];
[task resume];
}
i get this error 2020-11-06 13:07:36.125607+0000 App[8518:1786305] [NetworkInfo] Signal strength query returned error: Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied", descriptor: <CTServiceDescriptor 0x280000600, domain=1, instance=1> 2020-11-06 13:16:03.381478+0000 App[8518:1786223] Could not load IOSurface for time string. Rendering locally instead.