Understanding of release "not available" in Xcode4.2

Source: Internet
Author: User
Tags manual

Automatic Reference Counting (ARC) is a compilation-level feature used to develop Cocoa programs for Automatic memory management.

1: In XCode 4.2, create a project using the template, which will use the "ARC feature" by default.

2: You can select the project, Building Settings, and then find the Objective C Automatic Reference Counting (No, you can find it) for the created Project. Set it to No.

---- Theoretical basis of ARC ---

The working principle of ARC is that when you compile a program, the memory operation code (retain, release or autorelease) is automatically added to the desired position. That is, the same memory management mechanism as Manual Reference Counting (Manual Reference Counting) is used at the underlying layer. However, XCode automatically adds code for memory operations during compilation, which simplifies programming.

-Fobjc-ARC must be added to the compilation option when arc is enabled. However, this is done by XCode when creating a project template.

In versions earlier than XCode 4.2, ARC is not supported.

There are also requirements for the operating system: Mac OS X v10.6 or v10.7 (64-bit applications), iOS4 or iOS5. Note: Mac OS X v10.6 and iOS4 do not support weak references (weak references: what is weak references ).

Xcode 4.2 provides a tool named "Convert to Objective-C Automatic Reference Counting". Under the Edit-> Convert menu, you can automatically convert the old code using Manual Reference Counting into new code using ARC (for example, removing the call to retain and release ).

 

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.