-->

iBeacon Region monitoring: Not resumed when reboot

2019-04-15 21:15发布

问题:

all day I tested the monitoring of beacons my app does. in general it works ok:

  • notifications in foreground work
  • notifications in background work

BUT

after a reboot it doesn't work until I launch ANY app that uses BluetoothLE

after I do that it works fine for my app as well!


But if I set UIBackgroundMode location in my plist though, my app gets region notifications just fine even after a reboot.

So... is that it? or whats the deal here? :D this is under ios 7.1.1 btw

The code is very minimal: https://github.com/RadiusNetworks/ibeacon-background-demo/blob/master/BackgroundDemo/BDAppDelegate.m

回答1:

I did two things:

First, I reduced the time it took the app to launch >> mainly by doing stuff only when the app moves to the foreground. That was Step 1 but for the real app I was working on that alone was only half the solution

I then found out that the application in question tried to access the keychain in the background while the device was locked I moved that to a later point too and BING it worked!