ios 里如何判断当前应用的定位服务是否可用

  1. if ([CLLocationManager locationServicesEnabled] &&  
  2.                 ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized  
  3.                 || [CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined)) {  
  4.                 //定位功能可用,开始定位  
  5.                 _locationManger = [[CLLocationManager alloc] init];  
  6.                 locationManger.delegate = self;  
  7.                 [locationManger startUpdatingLocation];  
  8.             }  
  9.             else if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied){  
  10.         NSlog("定位功能不可用,提示用户或忽略");   
  11.             }  

posted on 2015-01-14 20:33  zhao_gw  阅读(239)  评论(0编辑  收藏  举报

导航