Set arc valid or invalid

Source: Internet
Author: User

On the compilation unit, you can set the arc to be valid or invalid. For example, for each file you can choose to use or not to use arc, an application can be mixed with arc valid or invalid binary form.

The valid compilation method for setting arc is as follows: (Xcode4.2 start default setting for all file arcs)

* Use Clang (LLVM compiler) version 3.0 or later

* Specifies that the compiler property is "-fobjc-arc"

Setting arc is valid or invalid, generally two ways: uniform operation on all files, operation on some files.

1. Unified operation for all files

  Requirements : Some programmers in order to better understand the memory management mechanism, deliberately specify the compiler as arc invalid.

  action : Targets---Build Settings--Apple LLVM 7.1-language-objective C--and Objective-c Automatic Re Ference counting and set it to No.

2. Operation of partial files

  requirements : Xcode often needs to import some third-party code files, if the project's compiler is specified as the arc mechanism, but the imported file is non-arc mechanism, when dealing with this situation, just tell the compiler to the foreign file by non-arc rules to compile, Other files are compiled according to ARC rules as usual.

  action : Targets---Build phases--expand compile Sources and find non-arc mechanism files after double-clicking on compiler flags, and entering - Fno-objc-arc.

  requirements : Xcode often needs to import some third-party code files, if the project's compiler is specified as a non-arc mechanism, but the imported file is the arc mechanism, when dealing with this situation, just tell the compiler to the external file by arc rules to compile, Other files are compiled as usual as non-arc rules.

  action : Targets---Build phases--expand compile Sources and find non-arc mechanism files after double-clicking on compiler flags, and entering - Fobjc-arc.

Set arc valid or invalid

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.