- if ([CLLocationManager locationServicesEnabled] &&
- ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized
- || [CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined)) {
- //定位功能可用,开始定位
- _locationManger = [[CLLocationManager alloc] init];
- locationManger.delegate = self;
- [locationManger startUpdatingLocation];
- }
- else if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied){
- NSlog("定位功能不可用,提示用户或忽略");
- }
时间: 2024-11-03 22:21:15