Okay so I’ve been happily using ARC in my project until I attempted to add some third party code to my project. I dragged the folder in (not a project file, just some viewcontroller source files). The 3rd party code was not ARC so I did Edit->Refactor->Convert To Objective-C ARC and choose ONLY the files from the 3rd party app to convert to ARC. Everything went swimmingly but I started getting the following warning in MY previously working code:
TTKSoundGenerator.m:94:10: warning: '__bridge' casts have no effect when not using ARC [-Warc-bridge-casts-disallowed-in-nonarc]
(__bridge CFStringRef)soundFile,
^~~~~~~~
1 warning generated.
This is the first clue that something is amiss. I go ahead and build and run and sure enough the app crashes where things are getting released while still being referenced. So ARC is not working at all despite the fact that the Objective-C Automatic Reference Counting is set to YES in project file.
I went back and did Edit->Refactor->Convert To Objective-C ARC on ALL the files in the project hoping to rectify this but no dice. So now the project is stuck in ARC limbo. It seems like unselecting files when doing the refactor somehow told Xcode to add a special case of ‘No ARC’ to those files. Any ideas on how to fix or further diagnose this?
Okay so apparently if you do Edit->Refactor->Convert To Objective-C ARC on a project and only choose some of the files to convert then Xcode will mark the rest as No ARC. Running Edit->Refactor->Convert To Objective-C ARC again on all the files has no further effect once that option has been set. The fix is to go to your project settings, under Build Phases->Compile Sources, select the files you want ARC re-enabled and remove the -fno-objc-arc compiler flags that refactor added.