I have the following code
BOOL ios5 = [mapview respondsToSelector:@selector(setUserTrackingMode:animated:)];
if(ios5)
{
if(compass && tracking)
[mapview setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:YES];
else if (tracking)
[mapview setUserTrackingMode:MKUserTrackingModeFollow animated:YES];
else
[mapview setUserTrackingMode:MKUserTrackingModeNone animated:YES];
}
else
{
// Do it the version 4.0 way
}
It works as expected depending on whether I have the compass or tracking flags on and tracks the user location in iOS 5.
However, it also works in version 4.3.3 which is the other device I’m testing on. It seems to respond to the selector and actually behaves as it does in iOS 5.
Is this because the functionality was in iOS 4 but not made public and I run the risk of the app being rejected for that reason?
Can anyone shed some light on this?
thanks
Donie
I believe you’re doing the right thing by checking the functionality first before using it. It doesn’t matter what version you’re running on, that API is already documented. By doing it this way you are providing backwards compatibility to your 4.3 users.