【问题标题】:Observe location services updates观察位置服务更新
【发布时间】:2014-06-20 02:06:45
【问题描述】:

当位置服务选项发生变化时,我如何观察和调用方法?例如,我的应用在后台运行定位服务,即设置中的选项设置为始终。如果用户在我的应用仍在运行时更改了选项怎么办,如何观察更改并相应地在我的应用中进行更改?

【问题讨论】:

    标签: ios ios7 ios8 location-services


    【解决方案1】:

    实现 CLLocationManagerDelegate 方法

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

    来自文档:

    “只要应用程序使用位置服务的能力发生变化,就会调用此方法。更改可能是因为用户允许或拒绝为您的应用程序或整个系统使用位置服务。”

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-24
      • 2023-03-03
      • 1970-01-01
      • 2017-10-24
      相关资源
      最近更新 更多