且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

关于 sendsynchronousRequest:returningResponse:error: 的警告:已弃用:在 ios 9- 中首次被弃用

更新时间:2022-12-08 10:21:29

你需要使用这样的方法:

You need to use that method like:

// Creating a data task
NSURLSessionDataTask *dataTask = [[NSURLSession sharedSession]
  dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
{
  // Use the data here
}];

// Starting the task
[dataTask resume];

请检查 dataTaskWithRequest:completionHandler: 了解更多详细信息.

Please check dataTaskWithRequest:completionHandler: for more detailed information.