XCode / iOS模拟器:手动触发重要的位置更改 [英] XCode / iOS simulator: Trigger significant location change manually

查看:426
本文介绍了XCode / iOS模拟器:手动触发重要的位置更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法手动告诉设备发送重要的位置更改通知,该通知会唤醒为此通知注册的所有应用程序?
这仅用于测试,我意识到这个私有API调用在提交到应用商店时会被拒绝。

Is there a way to manually tell the device to dispatch a significant location change notification that will wake up any applications registered for this notification? This is for testing only, and I realize this private API call would get rejected upon submission to the app store.

推荐答案

所以两个答案:

A)搭乘火车: - )

A) Hop on a train :-)

B)使用模拟器。在iOS 5.x模拟器中,有一个具有位置子菜单的调试菜单。选择高速公路驾驶。这将启动模拟器,沿着加利福尼亚州北部风景区280的假想之旅。它为您提供除视图之外的所有内容:您的应用将获得重要位置更改更新,并且如果已暂停,还将在后台启动

B) Use the simulator. In iOS 5.x simulator, there is a debug menu that has a location submenu. Choose freeway drive. This will start the simulator on an imaginary journey down the scenic 280 in Northern California. It gives you everything but the view: your app will get Significant Location Change updates, and will also be launched in the background if it has been suspended.

要确认您确实在移动,请在模拟器中启动safari,然后转到maps.google.com并单击小轨道我的位置按钮。你应该搬家。

To verify that you are actually moving, launch safari in the simulator, and go to maps.google.com and click the little track my location button. You should be moving.

太棒了!现在如何调试系统启动的生命周期问题?简单!让xCode等待您的应用程序启动以开始调试。从Scheme菜单中,选择edit scheme。在运行方案和信息选项卡中,对于启动设置,请选择:等待My.app启动

Awesome! Now how to debug the lifecycle problem of being launched by the system? Easy! Have xCode wait for your app to be launched to start debugging. From the Scheme menu, choose edit scheme. In the Run Scheme, and the Info tab, for the "Launch" setting choose : "Wait for My.app to launch".

在模拟器中运行您的应用程序一次,以便它开始监视位置更新,然后强制退出它,以便它被暂停。 在应用程序中添加断点确实完成启动功能,然后等待。一旦你的模拟器已经走得足够远,你的应用程序就会被唤醒,你的断点就会被击中,你也有钱。

Run your app once in the simulator, so that it starts monitoring for location updates, then force quit it, so that it is suspended. Add a break point in your application did finish launching function, and wait. As soon as your simulator has gone far enough, your application will be woken up, your breakpoint hit, and you are in the money.

但是真的,乘坐火车是更有趣。

But really, the train ride is more fun.

这篇关于XCode / iOS模拟器:手动触发重要的位置更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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