-2

I'm using AFNetworking in my app. After I have imported the files and build the app I get like 90 errors, complaining on the ARC mode.

ARC forbids explicit message send of 'autorelease'

I've tried to go to Edit -> Refractor -> Convert to Objective-C ARC

But then I got:

Cannot Convert to Objective-C ARC

Xcode found 93 issues that prevent conversion from proceeding.  Fix all ARC readiness issues and try again.

I don't get this...

tracifycray
  • 1,423
  • 4
  • 18
  • 29

3 Answers3

4

Don't attempt to migrate AFNetworking to ARC by yourself, either change to a newer version (which uses ARC) or disable ARC for the AFNetworking files. Better still use Cocoapod to manage your dependencies and forget about ARC mismatch problems.

Community
  • 1
  • 1
jbat100
  • 16,757
  • 4
  • 45
  • 70
  • Here's a [link](https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking) to getting set up with AFNetworking in Cocoapods. Using Cocoapods is a highly recommended approach to managing dependencies in your project. – JaredH Dec 15 '13 at 22:03
2

Make sure you download AFNetworking 2.0.

William Falcon
  • 9,813
  • 14
  • 67
  • 110
  • Ok, so I've downloaded 2.0. It seems like I have to change some things. I get the error: Use of undeclared identifier 'AFJSONRequestOperation' on: AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) { – tracifycray Nov 14 '13 at 22:49
  • Look through the api and rewrite your methods. You probably copied those from some forum using afnetworking 1.0. – William Falcon Nov 15 '13 at 00:04
1

In the Project Settings, under Build Phases, Compile Sources, select the AFNetworking files and add -fno-objc-arc as the compiler flag. This disables arc for those files.

I definitely agree though. Use Cocoapods or get AFNetworking 2.0 or 1.x with ARC

mergesort
  • 5,087
  • 13
  • 38
  • 63