xcode 为什么我的 ASIHTTPRequest 文件显示 ARC 错误?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8375508/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 22:40:06  来源:igfitidea点击:

Why are my ASIHTTPRequest files showing ARC errors?

iphoneobjective-ciosxcodeasihttprequest

提问by pixelbitlabs

I have implemented all of my ASIHTTPRequest files, but unfortunately the following errors occur:

我已经实现了我所有的 ASIHTTPRequest 文件,但不幸的是出现了以下错误:

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

Why is this happening?

为什么会这样?

回答by JosephH

ASIHTTPRequest doesn't support ARC, so it is expected you get errors if you use it in an project with ARC enabled.

ASIHTTPRequest 不支持 ARC,因此如果在启用了 ARC 的项目中使用它,预计会出现错误。

There are various solutions on how to disable ARC just for the asihttprequest files suggested here:

关于如何仅针对此处建议的 asihttprequest 文件禁用 ARC 的解决方案有多种:

https://github.com/pokeb/asi-http-request/issues/210

https://github.com/pokeb/asi-http-request/issues/210

The easiest one is just to disable ARC for the ASIHTTPRequest source files, see here : How can I disable ARC for a single file in a project?

最简单的方法是为 ASIHTTPRequest 源文件禁用 ARC,请参见此处:如何为项目中的单个文件禁用 ARC?

Someone has started what they called an ARC compliant HTTPRequest - basically a very small wrapper around NSURLConnection that has a similar interface to ASIHTTPRequest:

有人已经开始了他们所谓的 ARC 兼容 HTTPRequest——基本上是一个非常小的 NSURLConnection 包装器,它具有与 ASIHTTPRequest 类似的接口:

https://github.com/imathome/ARCHTTPRequest

https://github.com/imathome/ARCHTTPRequest

It doesn't support all/most of the features of the full ASIHTTPRequest though.

虽然它不支持完整 ASIHTTPRequest 的所有/大部分功能。

Finally, a lot of people are moving to use AFNetworking instead. The more recent versions all use ARC, although as the recommended way to use it is via CocoaPods the ARC compiler flags will be sorted out correctly automatically:

最后,很多人转而使用 AFNetworking。较新的版本都使用 ARC,尽管推荐的使用方式是通过 CocoaPods,ARC 编译器标志将自动正确排序:

https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking

https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking

回答by Rowdur

Try this new framework MKNetworkKit

试试这个新框架 MKNetworkKit

https://github.com/MugunthKumar/MKNetworkKit

https://github.com/MugunthKumar/MKNetworkKit

This supports ARC

这支持ARC

回答by Salman Iftikhar

you can use this. If you are using ARC. Benefit of using it is that i just create a wrapper over native URLConnection class so native support of libraries is more reliable.

你可以用这个。如果您使用的是 ARC。使用它的好处是我只是在本机 URLConnection 类上创建了一个包装器,因此对库的本机支持更可靠。

https://github.com/samspalace/SIKHttpRequest-ARC

https://github.com/samspalace/SIKHttpRequest-ARC

回答by sosborn

This is happening because when you enable ARC you cannot use the standard memory management methods like "retain", "release", etc. Just delete those method calls and you'll be fine. Or, if you want you can turn off ARC for those files.

发生这种情况是因为当您启用 ARC 时,您无法使用标准的内存管理方法,如“retain”、“release”等。只需删除这些方法调用就可以了。或者,如果您愿意,可以为这些文件关闭 ARC。

回答by Ankit Srivastava

ARC stands for automatic reference counting , where ios itself looks after retain, release , so either you should disable ARC or get the new ARC supported ASIHTTPRequest files... cheers.

ARC 代表自动引用计数,其中 ios 本身负责保留、释放,因此您应该禁用 ARC 或获取新的 ARC 支持的 ASIHTTPRequest 文件......干杯。