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

前端之家收集整理的这篇文章主要介绍了ios – 如何从终止状态调试应该由位置服务启动的iPhone应用程序到后台?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我们被告知,通过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

我的问题是,我将如何去调试和/或测试?一旦我终止应用程序,我不知道发生了什么(即调试会话被应用程序杀死).什么时候或者如果iOS在UIApplicationLaunchOptionsLocationKey的launchOption键的后台启动了我的应用程序?更重要的是,我如何知道执行的代码块是否正常运行?如何快速测试这种情况,而不必在终止我的应用程序之后开车,希望我写的神奇的代码工作?任何帮助,非常感谢!

解决方法

使用Xcode的Debug>附加到流程>通过进程标识符(PID)或名称菜单:您可以提供进程的名称,然后Xcode将等待启动以附加和启动调试会话.
原文链接:https://www.f2er.com/iOS/336183.html

猜你在找的iOS相关文章