I have an button, when you press it, you get the location. It only works on initial launch, not subsequent uses. Code below
- (IBAction)getLocationCoordinates:(UIButton *)sender {
if ([CLLocationManager locationServicesEnabled]) {
self.locationManager = [[CLLocationManager alloc]init];
self.locationManager.delegate = self;
[self.locationManager startUpdatingLocation];
}
}
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{
CLLocation *location = [locations lastObject];
[self.locationManager stopUpdatingLocation];
NSLog(@"%f %f", location.coordinate.longitude, location.coordinate.latitude);
self.locationProperty = location;
}