-(NSArray *)deviceCheck:(NSString *)device
{
NSString *deviceRequestString = [NSString stringWithFormat:@"%@?device=%@",webservice,device];
NSURL *JSONURL = [NSURL URLWithString:deviceRequestString];
NSURLResponse* response = nil;
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:JSONURL];
NSData* data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil];
if(data == nil)
return nil;
NSError *myError;
NSArray *tableArray = [[NSArray alloc]initWithArray:[NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&myError]];
return tableArray;
}
but I keep getting this warning:
sendSynchronousRequest:returningResponse:error:' is deprecated: first deprecated in iOS 9.0 - Use [NSURLSession dataTaskWithRequest:completionHandler:] (see NSURLSession.h
on this line:
NSData* data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil];
I tried changing to to the following:
NSData* data = [NSURLSession dataTaskWithRequest:request];
and
NSData* data = [NSURLSession dataTaskWithRequest:request returningResponse:&response error:nil];
both gave me errors saying:
No known class method
PLEASE HELP