gpt4 book ai didi

ios - 如何将本应由位置服务启动的 iPhone 应用程序从终止状态调试到后台?

转载 作者:IT王子 更新时间:2023-10-29 08:14:56 25 4
gpt4 key购买 nike

通过 Apple 在 startMonitoringSignificantLocationChanges 上的文档,我们被告知使用表示更改 API 的应用程序可能会出现以下行为:

If you start this service and your application is subsequently terminated, the system automatically relaunches the application into the background if a new event arrives. In such a case, the options dictionary passed to the locationManager:didUpdateLocations: method of your application delegate contains the key UIApplicationLaunchOptionsLocationKey to indicate that your application was launched because of a location event. Upon relaunch, you must still configure a location manager object and call this method to continue receiving location events. When you restart location services, the current event is delivered to your delegate immediately. In addition, the location property of your location manager object is populated with the most recent location object even before you start location services.

来源:Apple Docs

我的问题是,我将如何调试和/或测试它?一旦我终止应用程序,我就不知道发生了什么(即调试 session 被应用程序终止)。我什么时候才能知道 iOS 何时或是否在后台启动了我的应用程序并设置了 UIApplicationLaunchOptionsLocationKey 的 launchOption 键?比这更重要的是,我如何知道被执行的代码块是否正常运行?在终止我的应用程序希望我编写的代码神奇地工作后,我如何才能快速测试这个场景而不必四处走动?非常感谢任何帮助!!

最佳答案

使用 Xcode 的 Debug > Attach to Process > By Process Identifier (PID) or Name... 菜单:您可以提供进程的名称,然后 Xcode 将等待它启动以附加并启动调试 session 。

关于ios - 如何将本应由位置服务启动的 iPhone 应用程序从终止状态调试到后台?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19848629/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com