user1080937
user1080937

Reputation: 91

MapKit, run method on location-service-permission being granted

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

Answers (1)

Michael Frederick
Michael Frederick

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

Related Questions