针对ios 7,但支持ios 5+ monotouch [英] Targetting ios 7 but supporting ios 5+ monotouch

查看:138
本文介绍了针对ios 7,但支持ios 5+ monotouch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个针对iOS7的info.plist文件的应用程序。现在我想要定位iOS 7。此外,我也计划支持iOS 5和iOS 6.

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.

我的意思是我希望我的客户能够下载我的应用程序,无论他们是否运行iOS 5.X或6.X或iOS 7.有可能吗?

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?

推荐答案

是的,这当然是可能的。您需要将项目的部署目标设置为V5.0。为此,请打开项目选项,导航到IOS应用程序选项卡,然后将部署目标选项更改为5.0。

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.

因为您正在构建最新版本SDK必须非常小心,不要使用实际运行时不可用的任何API和功能。

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();

如果有疑问,Xamarin Studio的对象资源管理器提供了一些见解,因为大多数API成员都装饰有Export属性包含Since属性,表示引入API的IOS版本。 Export属性还包含在上面的代码中使用Selector构造函数的选择器的名称。

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.

最后一句话。根据某些来源,iOS6 6月份渗透率接近96%。从那时起最有可能上涨的数字。更不用说苹果公司报告说iOS7的渗透率已经达到了昨天的62%。如果我是你,如果支持iOS5值得麻烦,我会三思而后行。

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.

这篇关于针对ios 7,但支持ios 5+ monotouch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆