10

I have tried the solution found in this post to disable ARC in AFNetworking files, but to no avail:

enter image description here

Any ideas where I am failing? Obviously the simpler the answer the better. I have also read that creating static libraries may help, but this seems complicated.

EDITS

I have tried deleting derived data and Clean and Build and restarting Xcode. No deals :(.

Also, there are no other projects in my workspace.

Community
  • 1
  • 1
Eric Brotto
  • 53,471
  • 32
  • 129
  • 174
  • 1
    Puzzling. It should work as it is. I would delete Derived Data and restart Xcode (it's silly but Xcode is sillier). – Jano May 30 '12 at 15:14
  • Maybe you set the flags for one target and build the other? – lawicko May 30 '12 at 15:18
  • This does not answer your Xcode issue, but our team recently started using [CocoaPods](http://cocoapods.org/) to manage dependencies, and it saves us a lot of time. There is a spec for building AFNetworking into your projects, though I've not used AFNetworking. – David V May 30 '12 at 15:27
  • @Jano Please see Edit 1. – Eric Brotto May 30 '12 at 15:33
  • @Joe This is `AFNetworking`, not `ASIHTTPRequest`. They are completely separate. – Eric Brotto May 30 '12 at 15:34
  • @EricBrotto, what you have looks correct. Do you have any other projects in your Xcode workspace which might be compiling AFNetwork as well? – David V May 30 '12 at 15:36
  • I would just try the old tried and true, Clean --> Build. Those flags are correct and I had the same issue with AFNetworking when using ARC. – Bill Burgess May 30 '12 at 15:38
  • Another alternative, is to remove all references to AFNetworking from your project and then re-adding them. It sounds like a pain to me, but I've had co-workers claim this has fixed some odd Xcode problems. – David V May 30 '12 at 15:44
  • @EricBrotto Thanks for the clarification, the image was so small it looked like ASI. – Joe May 30 '12 at 15:48
  • It may actually be stale errors; i.e. does the project build fine even though the errors continue to show up? There have been bugs in Xcode in this area in the past, certainly, and they have been fixed over time. – bbum May 30 '12 at 16:36

7 Answers7

17

Weird thing. I tried adding the -fno-objc-arc flag to some Facebook files and the project finally built. I guess the lesson here is that when Xcode generates these types of errors, the source of the problem may be in another file. This may especially be true if Xcode is complaining about a file that you have already flagged!

enter image description here

Hopefully this will be of help to somebody :).

Eric Brotto
  • 53,471
  • 32
  • 129
  • 174
  • 3
    I am having the same problem. How did you know that it was the FB files that caused the problem? – Jason Nov 05 '12 at 15:30
5

Just a little additional hint:

If you have multiple targets in your project check if you added the compiler flag -fno-objc-arc to all of them.

Alpaslan Firat
  • 136
  • 2
  • 2
3

"Convert to Objective-C ARC" is a code rewriting tool, -fno-objc-arc on the other hand is a compile time flag. It's simply irrelevant for the purpose of refactoring.

Before you click "Check", expend the target and deselect the files you want to keep ARC-free.

Blago
  • 4,697
  • 2
  • 34
  • 29
2

Actually the problem is simple. Make sure there is no carriage return after the -fno-objc-arc flag you have entered in the compiler flags dialog.

Himanshu
  • 31,810
  • 31
  • 111
  • 133
DarkestOne
  • 21
  • 1
1

Had the same issue but was unable to find the offending file (as in Brotto's solution). So simply wrapped the non-arc complaint code snippets in the following #if statement block:

#if !(__has_feature(objc_arc))

//...non-arc code

#endif
Jalakoo
  • 3,523
  • 2
  • 21
  • 20
1

I managed to get into this state by a .m file that #imported a .m file that was not ARC compliant. The compiler complains about the included file, which may well be tagged -fno-objc-arc. I had to flag the .m that was doing the including.

I discovered this by expanding the build output on the failing and looking at the raw log which showed the file that was failing to compile (different from the one in the warning).

I also needed to delete the derived data file.

Ben Flynn
  • 18,524
  • 20
  • 97
  • 142
0

I was able to fix my issues by unchecking the non-ARC files in the Refactor -> Convert to Objective-C ARC modal. Even though the files were already being disincluded due to the 'fno-objc-arc' flag. Once I unchecked the files, Xcode started spitting out better errors that allowed me to find files that needed some fixing. After making those changes, I was good to go.

FreeAsInBeer
  • 12,937
  • 5
  • 50
  • 82