5

I have already created a project in XCode 4.2 with ARC checked. The problem is that I have to download and add the ASIHttpRequest files. This is giving a whole bunch of errors when I try to compile. Is there some way to fix this (other than to create a project again) ?

Ashish Agarwal
  • 13,427
  • 30
  • 79
  • 122
  • As an unrelated note, you may want to consider MKNetworkKit as a replacement for ASIHTTPRequest. ASIHTTPRequest is no longer supported. MKNetworkKit is ARC-compatible. https://github.com/MugunthKumar/MKNetworkKit – Rob Napier Jan 22 '12 at 04:20
  • 1
    And not just to shill my coauthor (MK), though I think his kit is quite nice, there is also AFNetworking, which is definitely worth a look. https://github.com/gowalla/AFNetworking – Rob Napier Jan 22 '12 at 04:22

3 Answers3

36

Click on the name of the project on the navigation view in the left side, go to Targets -> Build Phases and add -fno-objc-arc to the "compiler flags" for any relevant files.

Roy
  • 3,489
  • 1
  • 26
  • 38
4

You can turn off ARC per-file by passing the flag -fno-objc-arc to each as they are compiled. Add the flag to the files that need ARC disabled in the Compile Sources group under the target in the project navigator.

Another option would be to compile ASIHttpRequest as its own framework that doesn't have ARC enabled and just link against the framework. Speak of, isn't ASIHttpRequest already in a framework? (I've not looked at it in a while)

MyztikJenz
  • 1,640
  • 13
  • 19
3

Keep using ARC, but disable it for the ASIHttpRequest files. This answer should point you in the right direction:

How can I disable ARC for a single file in a project?

Community
  • 1
  • 1
sosborn
  • 14,486
  • 2
  • 39
  • 45