Hello,
I'm currently developing iPhone applications that -- for the time being -- need to be supported on versions prior to 4.x.
When I want to use something 4.x or 3.2 specific, I would use the usual approach of checking if a given class exists, i.e.:
if(NSClassFromString(@"SomeClass")) {
// do stuff here
}
This mostly works, except when it doesn't. Let me explain:
Classes like:
- UIMoviePlayerViewController (only available on 3.2+ according to the documentation)
- UIGestureRecognizer subclasses (like UIPanGestureRecognizer; UITapGestureRecognizer, etc.)
Actually resolve to valid classes, as if they were already available on private APIs on earlier versions. Is this the case, or am I missing something?
This is really bad, since the NSClassFromString()
approach is actually recommended by Apple.
To be on the safe side, I'm currently checking the OS version instead of doing runtime checking for the classes existence.
Anyone else having this problem? Thanks.