小编Pet*_*ith的帖子

核心位置iOS8与iOS7的兼容性

我在iOS8兼容应用程序中编写了以下代码.该应用程序在iOS8上工作正常,令我惊讶的是iOS7.我的问题是,为什么这个代码在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>
}
Run Code Online (Sandbox Code Playgroud)

常量kCLAuthorizationStatusAuthorizedWhenInUse和kCLAuthorizationStatusAuthorized总是在iOS8中引入,所以当我试图在iOS7模拟器中运行它时,我期待悲剧,但它运行得很好.这是一个我应该在真正的iOS7设备上担心的问题(我没有更多)或者有什么东西说这个代码适用于我不知道的iOS7吗?

先感谢您.

core-location ios ios7 ios8

3
推荐指数
1
解决办法
1684
查看次数

标签 统计

core-location ×1

ios ×1

ios7 ×1

ios8 ×1