iOS Development arc MRC Mixed

Source: Internet
Author: User

After Xcode5, the new iOS project, the default is the arc mode, but sometimes we need to use some third-party framework in the project, we download and found that is non-arc, this time we need to do arc and MRC mixed.

First way, Edit->refactor, convert to Arc mode

The famous iOS network Framework asihttprequest is MRC, we can try to convert to arc

Click Check, we found a tragedy.

In most cases this is going to go wrong, what should we do?

The second way, add markup to the compiler

Can be in the build phases in the compile sources to add the compilation tag-fno-objc-arc, it is feasible, but the file is much, this way is suitable for less files, the file is more than we want a one plus it, At this time we can use a tool xproj, this is a script, it is easy to add a folder to the files in the compilation tag, the specific way we look at the project home page, can be added to the ARC Project MRC Mark (-FNO-OBJC-ARC), You can also add an arc marker (-FOBJC-ARC) to an MRC project

Third Way, packaged into a static library

Drag the class we're going to use into the project

Tick the correct target

Delete the original class file, leaving only what we need, then we'll turn the whole project into MRC

Add header File

Set up a common header file

Running the program, we find that the static library has been generated

The disadvantage of this approach is that if you need to change the source, you need to repackage

One last way, project references

Create a new project, change to non-arc, and reference the project in another project

We need to remove the irrelevant files from Project B.

The last way to rewrite yourself into an arc way

iOS Development arc MRC Mixed

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.