Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have an Xcode (4.3.2) project with the latest SDK which I would like iOS 4.0 users to be able to run. So in project settings I have set the Deployment Target value to iOS 4.0. It is the same in the Targets settings.

However, I just realized my code is using an iOS 5+ API call. This one:

[self.tabController.tabBar setBackgroundImage:tabBackground];      //Invalid in iOS 4.x ???

The compiler is not giving me any warnings. Shouldn't it??? What will this do when executed on an iOS 4.0 device? Sadly, I don't have one to test on currently. This makes me extremely worried that there are other places where the same thing is happening and my program is now hopelessly tied to iOS 5.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
677 views
Welcome To Ask or Share your Answers For Others

1 Answer

The compiler will not warn you about those things unless you explicitly set the "base sdk" setting of your project to a lower iOS version.

Unfortunately the latest Xcode version does not seem to include any iOS SDKs prior to version 5.1, so you can't select 4.0 there. I would suggest keeping a second install of Xcode 3.x that comes with the iOS 4.0 SDK, and use that to make sure you aren't using methods from newer SDK versions. Finally, if you are really serious about iOS development and supporting 4.0 is a must for you (why?), you should test on a device that hasn't been upgraded to iOS 5.0 yet (e.g. older iPod touch off ebay..).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...