Apple's core location prompt - why does it jump back to Root View controller?

寵の児 提交于 2019-12-25 10:49:19

问题


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.

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.


回答1:


That should not be happening i dont think, post some code, maybe you are d oing something wrong..




回答2:


If you end up removing too many views, you sometimes end up in your rootViewController or the main window.




回答3:


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.



来源:https://stackoverflow.com/questions/1374331/apples-core-location-prompt-why-does-it-jump-back-to-root-view-controller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!