I'm using the following code to check to see if the user's location services for the app have changed. If they change they should view a different view controller. It really only needs to run each time the app launches and then redirect based on the [CLLocationManager authorizationStatus]
status
the problem with my code is that everytime the location updates the segue is ran.
thanks for any help
- (void)locationUpdate:(CLLocation *)location {
//locLabel.text = [location description];
NSLog(@"auth status is %u", [CLLocationManager authorizationStatus]);
if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized) {
[self performSegueWithIdentifier: @"SegueOffersGPS" sender: self];
} else {
[self performSegueWithIdentifier: @"SegueOffersNoGPS" sender: self];
}
If you want to stop updating location then write below code
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
[self.locationManger stopUpdatingLocation];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.