CLLocationManager AuthorizationStatus callback?

后端 未结 6 1830
天命终不由人
天命终不由人 2021-02-01 02:38

In my app I have a tab called \"Discover\". The Discover tab will use the users current location to find \"stuff\" near them. Instead of presenting the user with a generic Autho

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-01 03:22

    When the authorisation status for location changes, the delegate method didChangeAuthorizationStatus: will be called.

    When you call requestWhenInUseAuthorization the first time after your app is installed the delegate method will be called with status kCLAuthorizationStatusNotDetermined (0).

    If the user declines location services access then the delegate method will be called again with status kCLAuthorizationStatusDenied (2).

    If the user approves location services access then the delegate method will be called again with status kCLAuthorizationStatusAuthorizedAlways (3) or kCLAuthorizationStatusAuthorizedWhenInUse (4) depending on the permission that was requested.

    On subsequent executions of your app the delegate method will receive status kCLAuthorizationStatusDenied or kCLAuthorizationStatusAuthorizedAlways/kCLAuthorizationStatusAuthorizedWhenInUse after calling requestWhenInUseAuthorization based on the current state of location services permission for the app in the device settings.

提交回复
热议问题