문제

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