为什么 UIGestureRecognizer 检查会在 iPhone OS 3.0 上找到它,而它是在 3.2 中引入的?

发布于 2024-09-19 00:15:04 字数 603 浏览 4 评论 0原文

我是第一次使用 UIGestureRecognizer,我希望我的应用程序在 iOS 3.0 及以上版本上运行。 由于Apple明确声明该库在iOS 3.2中可用,后来我使用了以下代码:

// Make sure that Gesture recognition technology is supportted by the device SDK version
if ([UIGestureRecognizer instancesRespondToSelector:@selector(initWithTarget:action:)])
{
    [self initGestureRecognizers];
}

令人惊讶的是,当我在运行SDK3.0的唯一目标上运行该应用程序时,它工作正常。


我将条件替换为以下内容:

if ([[[UIDevice currentDevice] systemVersion] compare:@"3.2"] != NSOrderedAscending) 
{ 
    [self initGestureRecognizers]; 
}

我很乐意收到有关它的评论。

谢谢

I'm using UIGestureRecognizer for the first time and I want my app to run on iOS 3.0 onwards.
Since Apple clearly states that the library is available in iOS 3.2 and later I used the following code:

// Make sure that Gesture recognition technology is supportted by the device SDK version
if ([UIGestureRecognizer instancesRespondToSelector:@selector(initWithTarget:action:)])
{
    [self initGestureRecognizers];
}

Surprisingly, when I run the App on the only target I have, that run SDK3.0, it works fine.


I replaced the condition to the following:

if ([[[UIDevice currentDevice] systemVersion] compare:@"3.2"] != NSOrderedAscending) 
{ 
    [self initGestureRecognizers]; 
}

I would love to get comments about it.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

世界如花海般美丽 2024-09-26 00:15:04

这可能是因为 UIGestureRecognizer 在 3.2 之前被认为是私有的。如果您在 3.0 版本下使用 UIGestureRecognizer,如果某些事情存在错误或无法按预期工作,请不要感到惊讶。

That's probably because UIGestureRecognizer was considered private before 3.2. Don't be surprised if some things are buggy or don't quite work as expected if you use UIGestureRecognizer under 3.0.

无言温柔 2024-09-26 00:15:04

每个 iOS 版本中都有大量未记录的 API,Apple 也确实提到了这一点。然而,使用这些未记录的 API 会成为应用商店拒绝的理由。如果使用在操作系统的一个给定版本/修订版中未记录但在另一个版本/修订版中记录的 API,则很可能存在被拒绝的风险,而您的应用程序支持这两种版本/修订版。

There are tons of undocumented APIs in every iOS release, and Apple does mention this. However use of these undocumented APIs is grounds for an App store rejection. There may well be a risk of rejection from using an API that in undocumented in one given release/revision of the OS, but documented in another, both of which your app supports.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文