什么时候iphone应用程序接收到didChangeAuthorizationStatus:委托调用? [英] When does an iphone application receive didChangeAuthorizationStatus: delegate call?

查看:737
本文介绍了什么时候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: call?

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. 应用程序启动时。


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

I wrote a quick test app you can find here:

https://github.com/mharper/ LocationServices

只要方法被调用,它只需记录授权状态。

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

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

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