重大位置更改后,应用程序无法使用位置键启动 [英] Application doesn't launch with location key after a significant location change

查看:20
本文介绍了重大位置更改后,应用程序无法使用位置键启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在应用程序通过 CLLocationManager 类中的 startMonitoringSignificantLocationChanges 方法终止后,我的应用程序也会使用核心位置.

My application uses the core location also after the application terminates with the method startMonitoringSignificantLocationChanges in CLLocationManager class.

我的应用程序在 iOS 5 和 6 的方法中使用位置键启动:- (BOOL) 应用程序:应用程序 didFinishLaunchingWithOptions:launchOptions;在 AppDelegate 类中,一切正常.

My application launches with a location key in iOS 5 and 6 in the method: - (BOOL) application:application didFinishLaunchingWithOptions:launchOptions; in AppDelegate class and everything works well.

但在 iOS-7 测试版中,应用程序在位置发生重大变化后不会使用位置键启动.

But in iOS-7 betas the application doesn't launch with a location key after a significant location change.

有人遇到过这个问题吗?

Has anybody encountered this problem?

我在模拟器和设备上都试过了.

I tried it on a simulator and in the device.

感谢您的帮助.

推荐答案

当应用程序被用户从应用程序切换器终止时,我的应用程序也遇到了同样的问题.但如果它因内存不足或其他原因被操作系统终止,它会使用位置键启动.

I have the same problem in my app, when the app was terminated by user from app switcher. But it does launch with location key if it was terminated by OS for low memory or other reason.

不幸的是,这是 iOS7 的预期结果.我从他们的一位布道者那里得到的苹果官方回复:

It is the expected result from iOS7 unfortunately. An official apple response I got from one of their evangelists:

如果用户在应用切换器中向上滑动,则操作系统将不会启动该应用程序,除非用户明确告知这样做.所以不,SLC 会不会启动应用程序,也不会静默通知.唯一的此时将启动应用程序的是用户点击图标.这里的意图是用户已经表达了他们的选择出于任何原因不再运行该应用程序,因此我们很荣幸那.在这种情况下,你真的无能为力.这下次用户启动应用程序时,您可以让他们知道其中一些数据可能会丢失,尽管你真的无法判断是否是否缺少数据(即您可能已被操作系统杀死在后台,用户可能没有移动,因此没有触发任何 SLC 通知).我的建议是收集您可以在操作系统的策略中获取的数据以及用户是否拥有手动杀死该应用程序然后尊重该愿望并且不做任何事情.无论如何,如果发生这种变化,请随时提交错误报告行为最终会给您带来问题或(尤其是)混乱为您的用户.

If a user swipes up in the app switcher then the OS will not launch the app unless explicitly told to do so by the user. So no, SLC will not be launching the app, nor will silent notifications. The only thing that will launch the app at that point is the user tapping the icon. The intention here is that the user has expressed their choice of not having that app running any more for any reason, so we honor that. In this situation, there's really nothing that you can do. The next time the user launches the app you can let them know that some of the data may be missing, although you really cannot tell whether there's missing data or not (i.e. you might have been killed by the OS in the background and the user may not have moved thereby not triggering any SLC notifications). My suggestion would be to gather the data you can within the policies of the OS and if the user has manually killed the app then respect that wish and don't do anything. By all means, feel free to file a bug report if this change in behavior winds up causing problems for you or (especially) confusion for your users.

附上 Apple DEV 论坛的链接:https://devforums.apple.com/message/882691#882691

Attach link to Apple DEV forums: https://devforums.apple.com/message/882691#882691

这篇关于重大位置更改后,应用程序无法使用位置键启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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