I try to import a non-arc library(ASIHTTPRequest) to project.
but it reports arc error.
Is there a way to import a non-arc library to arc project?
Your comment welcome
Yes, It is possible to disable ARC for individual files by adding the -fno-objc-arc compiler flag for those files.
You have to add non arc flag -fno-objc-arc in all ASIHttpRequest Classes in ProjectSettings->BuildPhases->Compile Sources
ARC can be disabled on a ASIHTTPRequest files by file basis with the fno-objc-arc flag.
Set the no-objc-arc flag at path ProjectSettings->BuildPhases->Compile Sources->ASIHTTPRequest .m files.
But it is better to use AFNetworking classes for HTTP request handling now.
AFNetworking is best on now days, whereas ASIHTTPRequest is pretty much dead. Additionally, AFNetworking has dozens of great helper libraries and classes available for handling things like OAuth, Amazon S3, and the like.
AFNetworking also available for ARC support.No need to set flag.
Related
I have a project previously built in iOS 4.3. When I tried to invoke the “ARC” conversion tool with
Edit > Refactor > Convert to Objective-C ARC
from XCode 4.5.2, the tool reports many errors. Some are supposed to be modified automatically by itself, for example the keywords autorelease/release/retain should not be used.
The errors seem too many (1,987 occurrences) to resolve by hand. Are there any configuration options that i am missing or should something else be done?
If you are using existing libraries you can simply not use ARC for those libraries and begin using it throughout your app by using a flag.
Add this to your library or files in question to ignore ARC
-fno-objc-arc
i think you have used any third party libraries, if you have used any third party libraries then it won't helps you.that means in this situation it wont automatically converts it to ARC.
Unfortunately ARC manages memory only for objective-c objects, if you have used any C or C++ files then in this case you have to handle memory management yourself
I really wanted to use ASIHTTPRequest do to its easy and already built library. Since it is old code format and in the project I use ARC it doesn't really work. Are there any unofficial updates to it or is there other open source code out there that works well? I just find it very tedious to go back through this code and correct it and such.
Consider using AFNetworking in place of ASIHTTPRequest.
Or just disable ARC for ASIHTTPRequest, see #La boa boa
If your new project uses ARC, you can disable ARC for ASIHTTPRequest. Here's a good answer How can I disable ARC for a single file in a project?
The creator of AFNetworking wrote an adapter in order to ease the transition to AFNetworking from ASIHTTPRequest. See https://github.com/AFNetworking/AFNetworking-ASIHTTPRequest
Hope it helps.
Check this answer
https://stackoverflow.com/a/6658549/975959
It allows you to disable ARC for certain files and thus allowing you to use ASIHTTPRequest.
I've used it with that library successfully.
I have to make a rest web service call from my ios app, earlier I used ASIHTTPRequest with no ARC in xcode4, but now I have enabled ARC in my app in xcode4.2, please suggest what should I do? is there anything else which i can use to perform web service call?
If you're including the ASI source in your project, then mark the ASI files with -fno-objc-arc in the compile settings for each file. If you're including it as a static library, then you don't need to do anything.
Note that if there are method calls in ASI that don't obey the naming conventions for ownership (e.g. copy/new/alloc etc...) they you'll need to bridge some of the arguments in your method calls.
Check out the following section of this article for more info: http://www.learn-cocos2d.com/2011/11/everything-know-about-arc/#third-party-libraries
Does anyone know where I can get the class files for iOS XML-RPC that works with enabled ARC? So far I can't build by project because arc raises all kinds of exceptions.
Found that you can compile sources with the
-fno-objc-arc
flag. this makes a file with the flag compile without ARC.
I found https://github.com/rs/SDWebImage and https://github.com/markofjohnson/HJCache
Both good approach for image async download and caching on disk and memory.
Is there something similar but supporting ARC?
update: AFNetworking has added support to ARC. And for image caching, NSURLCache does disk caching since ios5, see here here
You can use those libraries in an ARC project by setting the -fno-objc-arc flag on the class files from the library. See this answer for instructions:
How can I disable ARC for a single file in a project?
ARC code can interoperate with ARC code without compromising the benefits to the code that your write yourself. ARC doesn't do anything magic except write your retain/release statements for you, so as long as SDWebImage doesn't have leaks, there's no benefit to converting it to ARC since the retain/release statements have already been written.