何时iPhone应用程序接收didChangeAuthorizationStatus:委托电话? [英] When does an iphone application receive didChangeAuthorizationStatus: delegate call?

查看:127
本文介绍了何时iPhone应用程序接收didChangeAuthorizationStatus:委托电话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于 CLLocationManagerDelegate 的问题。 消息委托:如果用户更改您的位置服务设置(在iPhone的Settings.app),那么你的应用程序应该接收 didChangeAuthorizationStatus的文件说。我的问题是,何时会出现这种情况?

I have a question about CLLocationManagerDelegate. The documentation says if the user changes the settings for your location services (in the iPhone's Settings.app) then your app is supposed to receive an didChangeAuthorizationStatus: message to the delegate. My question is, when would this happen?

如果用户更改设置,这意味着他们在设置应用程序,您的应用程序要么是后台运行或在前者的情况下根本没有运行,因此,当将你的应用程序的 CLLocationManager 委托获得 didChangeAuthorizationStatus:致电

If the user changed the setting, it means they are in the settings app, and your app is either backgrounded or not running at all, so in the former case, when would your app's CLLocationManager delegate get the didChangeAuthorizationStatus: call?

推荐答案

我只是碰到这种方法运行一个小时前,关于这个问题的好时机!

I just ran across this method an hour ago, so good timing on the question!

它看起来像我的情况下,这个方法被调用:

It looks like in my case this method gets called:


  1. 当应用程序被激活。

  2. 在允许使用位置服务的应用程序的初始启动的应用程序。

我写了一个快速测试应用程序,你可以在这里找到:

I wrote a quick test app you can find here:

<一个href=\"https://github.com/mharper/LocationServices\">https://github.com/mharper/LocationServices

它只需登录每当方法被调用的授权状态。

It simply logs the authorization status whenever the method gets called.

这篇关于何时iPhone应用程序接收didChangeAuthorizationStatus:委托电话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆