IOS Arc Project uses non-arc file __ios

Source: Internet
Author: User

Original address: http://blog.163.com/kefan_1987/blog/static/89780131201371211132188/

SDK4.0 introduced the arc, and it's been a year now and it's starting to find that there are a lot of projects that mix these two scenarios. Like what:

1. The old project did not use arc, but the introduction of the third party library is the use of arc.
2. Arc was used for its new project, but the introduction of Third-party libraries or previously written code did not use arc.

In both cases, the direct affirmation is not compiled. You can do this by upgrading the old project to use arc, but this is sometimes cumbersome.
An easy way to do this is to specify whether a single file is compiled with arc.
The method is in build phase inside compile source inside find the need for special processing files, plus the compilation option (Compiler Flags), specifically for the above two different situations.

1. For the first case, add the-FOBJC-ARC option to the source file that uses arc
2. For the second case, add-fno-objc-arc

In addition, Xcode seems to have a problem, click on a source file compiler flags entries, should show the cursor where there is no hint, the input character also has no echo, only after the knock, select other files to see the added compilation options ... This is really no word.



For a new variety of plug-ins to write, you can do this:

-(void) dealloc{
    //do Something in common
#if!__has_feature (OBJC_ARC)
    [Super Dealloc];
#else
    //nothing
#endif
}

Make it available in both arc and non-arc.

Related Article

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.