) In Xcode, configure ARC support for some files, and xcodearc

Source: Internet
Author: User

(Conversion) in Xcode, configure ARC support for some files, xcodearc

What is ARC?

ARC is a new feature launched by iOS 5, which is called Automation Reference Counting ). Simply put, the 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 editor. 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

In this case, the second column is named 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.

Similarly, if you want code that uses the ARC mechanism not to use the ARC mechanism, you only need to enter-fno-objc-arc

Related Article

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.