终止的应用程序无法通过iBeacon数据包唤醒 [英] Terminated App not wakeup with iBeacon packet

查看:278
本文介绍了终止的应用程序无法通过iBeacon数据包唤醒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS是否可以在睡眠状态下接收iBeacon数据包并唤醒应用程序?

Can iOS receive iBeacon packet in sleep state and wake up the app?

我杀死了一个应用程序,然后重新启动,然后将手机置于睡眠模式.重新启动设备时,该设备位于信标区域,重新启动后我保持设备屏幕关闭. 我的iOS应用未唤醒,因此我怀疑它没有收到iBeacon数据包.

I killed an app and restarted, then kept the phone in sleep mode. The device was was in beacon region when device reboot and I kept the device screen off after reboot. My iOS app is not waking, so I suspect its not receiving iBeacon packet.

我检查了系统日志,发现没有调用didEnterRegion过程.

I checked the system log and found that the didEnterRegion procedure is not getting called.

在强制终止应用程序的情况下,应用程序唤醒是否起作用?iOS是否在重新启动和立即进入睡眠状态时接收到iBeacon数据包?

Does app wakeup works incase of force terminated app and does iOS receive iBeacon packet in reboot and immediate sleep state?

如果我打开屏幕,则它会立即开始工作,但是如果屏幕在重启后关闭,则不会接收到iBeacon数据包.

If I make screen on then it starts working immediately but if screen is off after reboot its not receiving iBeacon packet.

推荐答案

是的,iOS CoreLocation会在区域进入或区域退出时启动您的应用程序,即使在iOS 7.1.1之后强制终止后仍能正常工作.如果您在AppDelegate的didFinishLaunchingWithOptions方法中设置了CLLocationManagerDelegate,则只会获得适当的回调.如果您未在该方法中进行设置,则CoreLocation将不知道在应用启动后进行回调.

Yes, iOS CoreLocation will launch your app on region entry or region exit, and works even after force termination after iOS 7.1.1. You will only get the appropriate callback if you set up your CLLocationManagerDelegate in the AppDelegate's didFinishLaunchingWithOptions method. If you do not set this up in that method, then CoreLocation will not know to make the callback after app launch.

在重新启动应用程序时测试进入事件可能会有些棘手,因此这里有一些避免陷阱的提示:

Testing entry events across an app restart can be a little tricky, so here are a few tips to avoid pitfalls:

  1. 如果至关重要,则您的应用程序会认为它在上次运行时位于该区域之外.如果它在上次运行时位于该区域内部",则它不一定会获得另一个条目回调,因为它将认为它永远不会离开.在测试时,请绝对确保在终止前,您收到didExit回调或didDetermineState回调,指出该回调不在区域内.使用NSLog语句,本地通知或添加到应用程序屏幕的一些自定义UI指示器来验证此操作.

  1. If is critical that your app think that it is "outside" the region when it was last running. If it was "inside" the region when it was last running, it won't necessarily get another entry callback because it will think it never left. When testing, make absolutely sure you get a didExit callback or a didDetermineState callback that says it is out of region before you kill the app or reboot. Verify this with a NSLog statement, a local notification, or some custom UI indicator added to a screen of your app.

如果您重新启动iOS设备,CoreLocation不会立即完全初始化-我已经看到屏幕打开后需要5分钟才能收到任何回调.确保等待足够长的时间.

If you reboot an iOS device, CoreLocation is not fully initialized right away -- I have seen it take 5 minutes after the screen comes on before I get any callbacks. Be sure you wait long enough.

一旦CoreLocation被完全初始化,区域进入事件通常在信标进入范围之内的一秒钟内发生.但是,如果有限的蓝牙硬件辅助模式插槽在设备上已全部装满(通常,如果您还有其他几个都使用了它们的信标应用程序,则会发生这种情况),则进入事件将退回到仅每10分钟或每10分钟发生一次的软件扫描中更多的.在这种情况下,进入事件可能需要花费很长时间.确保等待足够长的时间,然后再假设它不起作用.

Once CoreLocation is fully initialized, region entry events typically happen within one second of when the beacon comes into range. However, if the limited bluetooth hardware assist pattern slots are all full on the device (typically this happens if you have a few other beacon apps that have used them all), then entry events fall back to software scans that happen only every 10 minutes or more. An entry event can take that long in such a situation. Make sure you wait long enough before assuming it isn't working.

这篇关于终止的应用程序无法通过iBeacon数据包唤醒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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