系统的get请求

//请求对象
NSURLRequest * request = [NSURLRequest requestWithURL:url];
//会话对象
NSURLSession * session = [NSURLSession sharedSession];
NSURLSessionDataTask * dataTake = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
    
    if (error == nil) {
        
        NSDictionary * dict = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
     
        NSLog(@"************ 数据是 : : %@",dic);
        
    }

}];

//执行任务
[dataTake resume];

你可能感兴趣的:(系统的get请求)