How is iBeacon support REALLY changed in iOS 7.1?

后端 未结 5 1764
旧时难觅i
旧时难觅i 2020-12-14 11:18

I\'ve seen claims on the net that the newly released iOS 7.1\'s iBeacon support.

Specifically:

  1. The system is supposed to still notify your app about di
5条回答
  •  执笔经年
    2020-12-14 11:41

    As has been mentioned in several articles circulating around the internet, beacon sensing is available even when you swipe your app away from the multi-tasking view. However in my experiments, a region enter/exit event doesn't call the didDetermineState: directly (Probably because I hadn't been using the AppDelegate to initiate any beacon sensing but instead triggering monitoring based on UI events). Instead if you have registered for Background Location Updates, your AppDelegate's didFinishLaunchingWithOptions: method would get called with the value for key UIApplicationLaunchOptionsLocationKey in the parameter launchOptions set.

    You can do a simple check like this to test if this is indeed a location update that has bought your app into the background to perform some task.

    if ([launchOptions objectForKey:UIApplicationLaunchOptionsLocationKey])
    

    You can then either register your monitored regions again or start ranging immediately.

    P.S. CLLocationManager retains your previously monitoredRegions on app restore but without starting monitoring again using the same UUID and identity, you would not get the enter/exit region event in CLLocationManagerDelegate (which had brought your back up to life)

提交回复
热议问题