質問

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.

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top