开发者

Why does a check for UIGestureRecognizer find it on iPhone OS 3.0, when it was introduced in 3.2?

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"]开发者_如何学Python != NSOrderedAscending) 
{ 
    [self initGestureRecognizers]; 
}

I would love to get comments about it.

Thanks


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜