Set up arc support for some files in xcode non-arc Projects

Source: Internet
Author: User

ARC is a new feature launched by iOS 5, which is called Automation Reference counting ). Simply put, retain/release is automatically added to the Code. The Code that was manually added to handle the reference count of memory management can be automatically completed by the compiler. This mechanism starts to be imported in iOS 5/Mac OS X 10.7 and can be used in xcode4.2. A simple understanding of arc is to allow the compiler (llvm 3.0) to automatically generate the reference count of instances to manage part of the code During code compilation through the specified syntax. One thing is that arc is not a GC, but a static analyzer tool.

In xcode, you often need to import some external code files. If the imported file uses the arc mechanism and your current project does not use the arc, xcode will give a warning or report an error. How can we deal with these problems:

Click the project navigation file --> select targets --> select build phases --> Expand compile sources


At this time, we can see that the name of the second column is:Compiler flags

Double-click the arc file you want to use and enter-Fobjc-Arc,




Now this file can be compiled using the arc Mechanism during compilation.

Same as above. To prevent code using the arc mechanism from using the arc mechanism, you only need to enter -Fno-objc-Arc

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.