Core iOS8 compatibility with iOS7

In my iOS8 compatible app, I wrote the following code. The app works great on iOS8 and I'm surprised by iOS7. My question is, why doesn't this code crash on iOS7?

#import <CoreLocation/CoreLocation.h>
.
.
CLAuthorizationStatus authStatus = [CLLocationManager authorizationStatus];
.
// TODO some of these statuses are iOS8 only not iOS7 - need to check.
if ((authStatus == kCLAuthorizationStatusAuthorized) || (authStatus == kCLAuthorizationStatusAuthorizedAlways) ||
(authStatus == kCLAuthorizationStatusAuthorizedWhenInUse))    {
<some actual code>
}

      

The constants kCLAuthorizationStatusAuthorizedWhenInUse and kCLAuthorizationStatusAuthorizedAlways were introduced since iOS8, so I expected a tragedy when I tried to run it in the iOS7 simulator, but everything went fine. Is this a problem I should be concerned about on real iOS7 devices (I don't have it anymore), or is there something that suggests this code works on iOS7 that I don't know?

Thanks in advance.

+3


source to share


1 answer


In iOS7, values kCLAuthorizationStatusAuthorizedAlways

and kCLAuthorizationStatusAuthorizedWhenInUse

are listed for kCLAuthorizationStatusAuthorized

(which by the way is deprecated in iOS 8) using the iOS8 SDK. This is why you won't get any crash.



+7


source







All Articles