Apple的核心位置提示-为什么它跳回到Root View控制器? [英] Apple's core location prompt - why does it jump back to Root View controller?

查看:61
本文介绍了Apple的核心位置提示-为什么它跳回到Root View控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用UINavigationController的iPhone应用程序。在堆栈的第四个控制器上,我正在执行一些Core Location任务-因此,在用户使用我的应用的前几次中,系统会询问他们是否可以使用Location Services。 (我认为)这一过程我无法控制。

I have an iPhone app using a UINavigationController. On the fourth controller of the stack, I'm doing some Core Location stuff - so, the first couples of times that the user uses my app, they are asked if it's ok to use Location Services. This is a process that (I think) I don't have any control over.

在用户确认后,它们实际上被撞回到了导航控制器堆栈中的我的根视图控制器。这是一个错误,我做错了什么,还是这种预期的行为?我希望用户能够继续使用第四个控制器,而不必重新导航到它。

After the user confirms, they are actually bumped back to my root view controller in the navigation controller stack. Is this a bug, am I doing something wrong, or is this expected behavior? I want the user to be able to continue on the fourth controller instead of having to re-navigate back to it.

如果可以预料的是,我想可以加入用户启动应用程序后立即定位服务,而不是在我的第四个View Controller中。

If it's expected behaivor, I suppose I could kick in the location services as soon as the user starts the app, instead of in my fourth View Controller.

推荐答案

问题是我将我所有的应用初始化代码都放在了applicationDidBecomeActive:消息中。用户决定允许使用位置服务后,将发送UIApplicationDidBecomeActiveNotification消息,从而导致调用applicationDidBecomeActive消息。

The problem is that I was putting all of my app initialization code in the applicationDidBecomeActive: message. After the user decides to allow location services to be used, an UIApplicationDidBecomeActiveNotification message is sent which causes the applicationDidBecomeActive message to be called.

这篇关于Apple的核心位置提示-为什么它跳回到Root View控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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