Reputation: 91
I have an app with a mapkit that loads annotations during the ViewDidLoad using a loadAnnotations method. But I don't want to run said method (load the annotations) until permission is granted to use the current userLocation. Is this possible?
Upvotes: 0
Views: 143
Reputation: 16714
Yes it is possible. You request permission to use the users location using an instance of CLLocationManager
(using [locationManager startUpdatingLocation]
). You need to set the delegate of your CLLocationManager and have it adhere to the CLLocationManagerDelegate protocol. Specifically, you want to use this method on your delegate:
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
Upvotes: 1