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

不想你离开。 提交于 2019-11-28 07:38:18

问题


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.


回答1:


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:

(taken from Ray Wenderlich tutorial page)



来源:https://stackoverflow.com/questions/9865847/is-it-possible-to-combine-non-arc-and-arc-project-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!