iBeacon detection wake up iPhone from sleep mode w

2019-08-06 08:29发布

问题:

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.