Working with a non-arc (or arc) framework or class library in an arc project

Source: Internet
Author: User

Since ios5, automatic reference count (ARC) has been introduced, that is, every time an obj-C object is "used", the reference count will increase by 1, when the reference count is 0, the system recycles the memory. These are all done by the compiler itself. Rather than the arc in the OC program, the alloc should be release, and the retain/copy should also be release, which is a non-arc in the legend.

When using a third-party class library, sometimes the memory management mechanism of the third-party class library is different from its own, but I still want to use it. What should I do?

The specific method is as follows:

1. select targets in the project and select the target you want to operate on,


2. select build phases. In complie sources, double-click the file that requires arc, and enter-fobjc-arc in the input box. If not, enter-fno-objc-arc.


That is to say, if your project is non-arc and the third-party class library is using arc, you only need to add the following file after the third-party class library that uses arc:-fobjc-arc, otherwise, add-fno-objc-arc.

, I used an arc class library in a non-arc project. The setting method is as follows:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/40/4E/wKiom1POXHWijX8RAAZEUjq8rfc676.jpg "Title =" QQ20140722-1.png "alt =" wkiom1poxhwijx8raazeujq8rfc676.jpg "/>

This article is from the "one hair" blog, please be sure to keep this source http://winann.blog.51cto.com/4424329/1441522

Working with a non-arc (or arc) framework or class library in an arc project

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.