问题
I have an application that targeted iOS7 at its info.plist file. Now I want to target iOS 7 . Also I have a plan to support iOS 5 and iOS 6 too.
I mean that I want my clients be able to download my application whether they are running iOS 5.X or 6.X or iOS 7. Is it possible?
回答1:
Yes that is certainly possible. You need to set the deployment target of your project to Version 5.0. To do that, open the Project Options, navigate to the "IOS Application" Tab and change the "Deployment Target" option to 5.0.
Since you are building against the latest SDK you have to be very careful to not use any APIs and features not available on the actual runtime.
It is best practice to not check for version number but rather test if the object in question responds to a specific selector:
if ( UINavigationBar.Appearance.RespondsToSelector( new Selector("setShadowImage:")))
UINavigationBar.Appearance.ShadowImage = new UIImage();
When in doubt, Xamarin Studio's Object Explorer provides some insight since most of the API members are decorated with an Export attribute that among others contains a Since property, indicating the the IOS version that introduced the API. The Export attribute also contains the name of the selector to use with Selector constructor in the code snipped above.
One final remark. According to some sources, iOS6 penetration was close to 96% back in June. A number which has most likely risen since then. Not to mention that Apple reported iOS7 penetration to be already at 62% yesterday's event. If I was you, I would think twice if supporting iOS5 is worth the hassle.
回答2:
Apple does not support backward compatibility but surely supports forward compatibility but we have to take care of design issues if you really want to support iOS7 too.
To change the deployment target of the application select the project name and go to target and then select deployment target from right pane.It will support os above that version which you choose.
来源:https://stackoverflow.com/questions/19538491/targetting-ios-7-but-supporting-ios-5-monotouch