Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to combine non-ARC and ARC project code?

Is it possible to combine ARC and non-ARC projects? I haven't really tried it yet but this is the scenario:

We have an old iOS project (non-ARC) with a tab controller. There is a tab from the tab controller that doesn't have any function or view yet. I am making a new project which is related to the old project, and I would like to have it use ARC, if it is possible to combine my new project with the old one and assign my new project's view to the tab.

like image 643
Jenn Eve Avatar asked Mar 26 '12 02:03

Jenn Eve


People also ask

Does Objective-C support Arc?

Automatic Reference Counting (ARC) is a memory management option for Objective-C provided by the Clang compiler. When compiling Objective-C code with ARC enabled, the compiler will effectively retain, release, or autorelease where appropriate to ensure the object's lifetime extends through, at least, its last use.

How do I disable arc in Objective-C?

You can disable ARC for a specific class using the -fno-objc-arc compiler flag for that class. In Xcode, in the target Build Phases tab, open the Compile Sources group to reveal the source file list. Double-click the file for which you want to set the flag, enter -fno-objc-arc in the pop-up panel, then click Done.

What is Automatic Reference Counting in iOS?

Swift uses Automatic Reference Counting (ARC) to track and manage your app's memory usage. In most cases, this means that memory management “just works” in Swift, and you don't need to think about memory management yourself.

What is ARC compiler?

Automatic Reference Counting (ARC) is a memory management feature of the Clang compiler providing automatic reference counting for the Objective-C and Swift programming languages.


1 Answers

Yes of course and it is very easy. Start your new project with arc and just "tag" the old imported .m files with the not arc thingy. Follow this tutorial to see how:

http://www.raywenderlich.com/5677/beginning-arc-in-ios-5-part-1

(explains about how to convert but also about how to maintain in a non arc fashion)

Edit: The non arc tag is -fno-objc-arc you should set the files that you want xcode to consider non arc like this:

enter image description here

(taken from Ray Wenderlich tutorial page)

like image 137
Pochi Avatar answered Sep 28 '22 07:09

Pochi