Question

Is there a way to delay code from running until the user has answered the current location prompt? My app fetches annotations and puts them on the map. When the app launches for the first time and the user allows current location it fails to fetch any annotations because the code already ran without receiving a current location. Thanks in advance.

Was it helpful?

Solution

You can implement the following CLLocationManagerDelegate method:

- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status

and only show your annotations after that method is called. It will be called when the user accepts or rejects the current location prompt.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top