Compatibility with different versions for IOS Development 3 (# ifdef _ IPHONE_7_0 BaseSDK Development Target)

Source: Internet
Author: User

Continue with previous articles

In xcode, you can set the sdk in two other places. One is the Development Target, which indicates the version of the compiled app that can be run on another terminal. The setting method is as follows:



The other is the Base SDK, which refers to the SDK version used for current compilation. The setting method is as follows:



Pay attention to these two issues during Development. For example, if you use xcode5.0 to set the app to be developed to iOS7.0 by default and want to adapt to iOS6.1, you need to change the Development Target to iOS 6.1, the simulator is set to iOS6.1, and then the program runs under iOS6.1. However, if BaseSDK is not set, the project runs based on SDK7.0 compilation and SDK6.1, which is very likely to crash, for example, because of tintColZ? Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> vcsr00NTV0rK7tb22 + release/release + release/QtMnP0ru + 5DwvcD4KPHA + PHByZSBjbGFzcz0 =" brush: java; "> self. window. tintColor = [UIColor redColor];
Run the program without errors. Change the Development Target to 6.1 and the simulator to 6.1.

Then run, compile, but run crash, print

2014-03-21 09:26:58.253 TestTarget2[77981:907] -[UIWindow setTintColor:]: unrecognized selector sent to instance 0x75728502014-03-21 09:26:58.284 TestTarget2[77981:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIWindow setTintColor:]: unrecognized selector sent to instance 0x7572850'

This is because the program is compiled under SDK7.0 and tintColor is normal, but it runs under SDK6.1. tintColor is not found in 6.1, and the result crashes. If you change BaseSDK to 6.1 and run it again, a compilation error occurs and it cannot be run.


Change the above sentence

#ifdef __IPHONE_7_0    self.window.tintColor = [UIColor redColor];#endif

Re-run, perfect pass ......

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.