标签:des style blog http io ar color os 使用
1
|
@property (nonatomic, strong) CLLocationManager *locationManager; |
1
2
3
4
5
|
self.locationManager = [[CLLocationManager alloc]init]; _locationManager.delegate = self; _locationManager.desiredAccuracy = kCLLocationAccuracyBest; _locationManager.distanceFilter = 10; [_locationManager startUpdatingLocation]; |
|
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { CLLocation *currLocation = [locations lastObject]; NSLog(@"经度=%f 纬度=%f 高度=%f", currLocation.coordinrdinate.longitude, currLocation.altitude); } |
|
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { if ([error code] == kCLErrorDenied) { //访问被拒绝 } if ([error code] == kCLErrorLocationUnknown) { //无法获取位置信息 } } |
|
- (void)viewWillDisappear:(BOOL)animated{ [super viewWillDisappear:animated]; [_locationManager stopUpdatingLocation]; } |
|
self.locationManager = [[CLLocationManager alloc]init]; _locationManager.delegate = self; _locationManager.desiredAccuracy = kCLLocationAccuracyBest; _locationManager.distanceFilter = 10; [_locationManager requestAlwaysAuthorization]; //添加这句[_locationManager startUpdatingLocation]; |
标签:des style blog http io ar color os 使用
原文地址:http://blog.csdn.net/androidmylove/article/details/41790047