简体   繁体   中英

How can I remove ARC from iPhone project build for iOS 5?

Now I have a Xcode project which is built for iOS 5, but now i have to install it on an iPhone 3GS, which has a older iOS. I came to know that this is because I am using ARC in this project and it is not available in iOS 3.2. How can I remove ARC from my current project?

If you want it disabled for the whole project, you need to go to the target's build settings and set it to No 在此输入图像描述

在此输入图像描述 very simple first go to targets in that go "buldphases"-->compileSource--> here " yourfile.m " --> set value - fno-objc-arc (only particular files )

if u want remove ARC in entire project go to targets in that go "buldsettings" ---> objective-c automaticrefcount :NO

在此输入图像描述

Go Build Settings确保选中“all”选项搜索自动你会发现Objective-c Automatic Reference计数设置NO

In XCode, there is a global compiler flag called -fobjc-arc . If you disable this ( -fno-objc-arc ), ARC will be disabled in your whole project. If only a few files don't support ARC, use the -fno-objc-arc flag on those files only. The last flag "wins", see http://clang.llvm.org/docs/AutomaticReferenceCounting.html#general .

However, make sure that you know what you're doing! If the project was designed around ARC, there may not be any deallocation-code in there, including dealloc methods. Also, your properties might be unsupported ( strong , weak etc.). You'll most likely end up in a complete mess.

Your best bet would be to just upgrade your 3GS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM