Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could i build a ARC framework and use it in a non-ARC project?

I think the title explains my question pretty well, I'm currently working on a small framework for my personal needs, and thought about building it with ARC (if thats possible at all?), and use it in old projects that were built before ARC?

like image 658
Shai Mishali Avatar asked Nov 01 '11 13:11

Shai Mishali


3 Answers

Yes, with one caveat: if you have iOS 4.x as a deployment target, a supplemental library is necessary to deal with ARC-compiled code on the older runtime. For an application built using ARC, this is packaged in with the application. This is not included if you are using an ARC-compiled library in a non-ARC application.

You can manually link this library into your non-ARC application to avoid runtime problems on the older OS versions by adding -fobjc-arc to your Other Linker Flags for the application.

See this Apple Developer Forums thread for some more discussion on this.

like image 83
Brad Larson Avatar answered Sep 29 '22 12:09

Brad Larson


You can link against the glue library provided by Apple (as Brad has said in his answer above). However, the __weak variable qualifier is not compatible with operating systems below 4.3 (As mentioned here: iOS 5 Best Practice (Release/retain?) in a comment by sudo).

like image 39
Paul de Lange Avatar answered Sep 29 '22 14:09

Paul de Lange


Should be fine. The library is already compiled, so ARC/NonARC shouldn't matter anymore.

like image 40
Patrick Perini Avatar answered Sep 29 '22 13:09

Patrick Perini