不推荐使用NSURLConnection initWithRequest [英] NSURLConnection initWithRequest is deprecated

查看:493
本文介绍了不推荐使用NSURLConnection initWithRequest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在iOS中采用 Gmail API ,我收到警告:

I am adopting the Gmail API in iOS and I am getting the warning:


不推荐使用initWithRequest

initWithRequest is deprecated

在以下行中:

connection_ = [[connectionClass alloc] initWithRequest:request_ delegate:self startImmediately:NO];

该行位于API库的源文件GTMHTTPFetcher.m中。

The line is in the source file GTMHTTPFetcher.m of the API library.

弃用的 -initWithRequest:方法的替代品是什么?

What is the substitute for the deprecated -initWithRequest: method?

推荐答案

似乎在iOS 9中已弃用整个 NSURLConnection API。应用程序将继续工作,但新版本(与iOS SDK链接)必须使用较新的 NSURLSession API。

It seems that the whole NSURLConnection API has been deprecated in iOS 9. Existing apps will continue to work, but new builds (linked against iOS SDK) must use the newer NSURLSession API.

Ray Wenderlich有一本很好的教程这里
另外,当然,请查看官方文档

Ray Wenderlich has a good tutorial here. Also, of course, check the official documentation.

这篇关于不推荐使用NSURLConnection initWithRequest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆