OC in ARC forbids explicit message send of release error

Source: Internet
Author: User

In iOS programming, if the member variable is an object, we need to manage the member variable memory, otherwise it will cause a memory leak. That is, we are going to do a manual memory release of the member variables.

Obviously, it's the arc problem. Error reason: the "use Automatic Reference counting" option was selected when the project was created, but the release method of the object was called. What is arc? ARC is a new feature of iOS 5, called arc (Automatic referencecounting). Simply put, it is the code that automatically joins the Retain/release, and the code that originally needed to manually add a reference count to handle memory management can be automatically completed by the compiler. This mechanism is started in iOS 5/mac OS X 10.7 and can be used with Xcode4.2. The simple understanding of arc is that by specifying the syntax, the compiler (LLVM3.0) automatically generates the reference count of the instance when the code is compiled to manage part of the code. One thing, ARC is not a GC, it's just a code static analysis (Staticanalyzer) tool.

WORKAROUND: Select the project name to be selected, double-click, and enter Build setting

Change the middle objective-c Automatic Reference counting to No

OC in ARC forbids explicit message send of release error

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.