I've seen lots of info about converting a whole project to arc and then using flags to tell Xcode which ones not to convert.
What about converting only individual files to arc? I tried it, and it runs fine. Can I do that? I'm kind of worried that since the whole project isn't converted to arc if I convert things here and there they'll cause memory leaks.
Yes, you can. However, you need to tell the compiler which files are not ARC. This you can do in your project settings. Go to your project
> Select the target of the app in question
> Build Phases
. Now drop down the "Compile Sources" and select the files you wish not to compile with ARC, press ENTER and a little popup box will appear. Here you can write -fno-objc-arc
. Press Done
and you are done.
When compiling, it will try to add automated reference counting to the files which do not have the -fno-objc-arc
flag. Very usefull when using non-arc libs such as ASIHTTPRequest or MBProgressHud (and others).
To tell only certain file is ARC use flag:
-fobjc-arc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With