iBeacon detection wake up iPhone from sleep mode with UILocalNotification

折月煮酒 提交于 2019-12-24 16:39:51

问题


My application run on iOS 8 and when it go into background it need to detect and show a notification to the user when iBeacon detected (with UILocalNotification).

All works fine but when the iPhone is sleep/locked the Notification doesn't wake up the device.

How can I wake up the device when a notification come in?


回答1:


Make sure the phone is detecting the beacon at all. Try adding a NSLog statement inside the didEnterRegion method or wherever you launch the notification. Then, start looking at the debug console while the phone screen is off and turn on the beacon. Do you get a debug line?

If you do not see the debug line, the issue is with detection, not with the notification. Note that it can take up to 15 minutes on an iPhone 4S to detect a beacon.

If this does not help, please post your code that sets up region monitoring and sends the notification. Also, please, describe how you are testing entering and exiting the region.



来源:https://stackoverflow.com/questions/26497626/ibeacon-detection-wake-up-iphone-from-sleep-mode-with-uilocalnotification

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!