ASIHTTPRequest POST library - ios

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.

Related

Are commented codes removed from compiled binary for iOS Swift?

New to Swift, couldn't find an answer to this with a reliable source.
I have some commented code, but would like to know if they are removed when compiled/run in Debug/Release, and if this is enforced or can be turned on/off.
If they are indeed removed, what about those instances where I really need them to be inside, e.g. some framework or something?
Thanks in advance!
If you create inline docs in a swift package, they're available to the consumer. If you provide a Docc asset, that will also be available to the consumer.
If you create a binary, that depends on how it's created and distributed.
Unless there is a security concern not to share the source code, I would do a vanilla SwiftPackage with documentation comments.

import a non-arc library to project

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.

Using two versions of a Cocoapod dependency

So I'm trying to get with the times and use some of the new features offered in AFNetworking 2.0. However, I am also using RestKit 0.20 which has AFNetworking 1.3 as a dependency? Am I allowed to incorporate AFNetworking 1.3 and 2.0 into my Xcode project or can I only pick one? Is there a CocoaPod trick for this?
https://github.com/AFNetworking/AFNetworking
https://github.com/RestKit/RestKit
CocoaPods does not (currently) do dependency resolution with multiple versions of the same library. I'm not sure about the technical difficulties surrounding this but I believe one way to think about why it would be a pain is duplicate symbol errors that we've all undoubtably seen before. Unless RestKit updates their AFNetworking integration, which would take some doing I'm sure for such a large library, you'll have to pick which one you need more.
I wanted to mention that if you're using RestKit, this framework is meant to Abstract out you Networking operations, so if you project allows for it, it would be best not to use AFNetworking directly, and let restKit do the work instead. Being that said, I would also point out that you can use the dependency used by restKit (i.e 'AFNetworking', '~> 1.3.0'), and Just Use the previous API provided by AFNetworking, in case you really need to make direct use of this library.
Hope it helps =)

Are there caching framework like SDWebImage or HJCache supporting 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.

Howto use Twitter-OAuth-iPhone with iOS5 and ARC

I am trying to use Ben Gottliebs Twitter-OAuth-iPhone within an iOS5 app that uses ARC.
I already flagged the files with -fno-objc-arc. But now I get a lot of errors. I don't know where to start. Without ARC the framework seems to work just fine. Any help would be appreciated.
Edit: it seems that is has something to do with SecKeychainItemRef
I can not find the answer here: https://stackoverflow.com/questions/3675522/how-to-use-mgtwitterengine-for-iphone
I hope is not considered bad etiquette to recommend my own project, but I believe it's relevant to this question, so...
I just published a new OAuth library to GitHub that's fully ARC compatible. It comes with a working demo that implements the whole Twitter OAuth flow and allows you to post a tweet. You can find it here: RSOAuthEngine.
You might want to consider using the official Twitter API that's available with iOS 5. Here's a post on how to use it: http://www.peterfriese.de/the-accounts-and-twitter-framework-on-ios-5/
You could just tell the compiler not to use ARC on the files included in that library.
ios5 ARC what is the compiler flag to exclude a file from ARC?

Resources