- (void)viewDidLoad {
[super viewDidLoad];
self.clm = [[CLLocationManager alloc] init];
[_clm setDelegate:self];
_clm.desiredAccuracy = kCLLocationAccuracyBest;
_clm.distanceFilter = kCLDistanceFilterNone;
[_clm requestAlwaysAuthorization];
[_clm startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateLocations:(NSArray *)locations
{
NSLog(@"%@",locations);
CLLocation *location = [_clm location];
NSString *string = [NSString stringWithFormat:@"%f,%f",location.coordinate.latitude,location.coordinate.longitude];
[_nowFiled setText:string];
}
When I enabled simulate location, I can get location updated. When I disabled simulate location, I cannot get location updated.
- How can fixed this?
- How can I get delegate method invoked?
- Did I miss something?
- Maybe need time to get location?