Hi everyone,
I cannot find a solution to the following issue I am facing. In this small test app, which I set up based on the tutorial for ranging on iOS, my code looks like this:
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, ESTBeaconManagerDelegate {
var window: UIWindow?
let beaconManager = ESTBeaconManager()
let beaconRegion = CLBeaconRegion(
proximityUUID: UUID(uuidString: "4936C7D0-DC7A-4B3D-8402-64E4501EEC64")!,
identifier: "1234567890")
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
self.beaconManager.delegate = self
self.beaconManager.requestAlwaysAuthorization()
self.beaconManager.startMonitoring(for: self.beaconRegion)
self.beaconManager.startRangingBeacons(in: self.beaconRegion)
UIApplication.shared.registerUserNotificationSettings(
UIUserNotificationSettings(types: .alert, categories: nil))
return true
}
func beaconManager(_ manager: Any, didRangeBeacons beacons: [CLBeacon],
in region: CLBeaconRegion) {
NSLog("Region Ranging: active ...")
if (beacons.count > 0) {
print(beacons)
}
}
}
Once I run the app on my iPhone and check the log, it looks like this:
2017-09-05 19:23:51.919030+0100 Estimote Test[1691:498775] Region Ranging: active ...
2017-09-05 19:23:52.930651+0100 Estimote Test[1691:498775] Region Ranging: active ...
[CLBeacon (uuid:4936C7D0-DC7A-4B3D-8402-64E4501EEC64, major:1, minor:1, proximity:1 +/- 0.07m, rssi:-55)]
2017-09-05 19:23:53.926099+0100 Estimote Test[1691:498775] Region Ranging: active ...
2017-09-05 19:23:54.917538+0100 Estimote Test[1691:498775] Region Ranging: active ...
[CLBeacon (uuid:4936C7D0-DC7A-4B3D-8402-64E4501EEC64, major:1, minor:1, proximity:1 +/- 0.08m, rssi:-56)]
2017-09-05 19:23:55.926351+0100 Estimote Test[1691:498775] Region Ranging: active ...
2017-09-05 19:23:56.918447+0100 Estimote Test[1691:498775] Region Ranging: active ...
[CLBeacon (uuid:4936C7D0-DC7A-4B3D-8402-64E4501EEC64, major:1, minor:1, proximity:1 +/- 0.08m, rssi:-56)]
2017-09-05 19:23:57.919728+0100 Estimote Test[1691:498775] Region Ranging: active ...
[CLBeacon (uuid:4936C7D0-DC7A-4B3D-8402-64E4501EEC64, major:1, minor:1, proximity:1 +/- 0.09m, rssi:-57)]
2017-09-05 19:23:58.917537+0100 Estimote Test[1691:498775] Region Ranging: active ...
2017-09-05 19:23:59.917476+0100 Estimote Test[1691:498775] Region Ranging: active ...
2017-09-05 19:24:00.915645+0100 Estimote Test[1691:498775] Region Ranging: active ...
2017-09-05 19:24:01.918962+0100 Estimote Test[1691:498775] Region Ranging: active ...
[CLBeacon (uuid:4936C7D0-DC7A-4B3D-8402-64E4501EEC64, major:1, minor:1, proximity:1 +/- 0.08m, rssi:-56)]
2017-09-05 19:24:02.923122+0100 Estimote Test[1691:498775] Region Ranging: active ...
Once I put the app to background, and come back after a few minutes, without touching the beacon, the log looks like this:
2017-09-05 19:28:17.874827+0100 Estimote Test[1691:498775] Region Ranging: active ...
2017-09-05 19:28:18.892604+0100 Estimote Test[1691:498775] Region Ranging: active ...
2017-09-05 19:28:55.902272+0100 Estimote Test[1691:498775] Region Ranging: active ...
2017-09-05 19:28:56.901704+0100 Estimote Test[1691:498775] Region Ranging: active ...
2017-09-05 19:28:57.896723+0100 Estimote Test[1691:498775] Region Ranging: active ...
2017-09-05 19:28:58.901165+0100 Estimote Test[1691:498775] Region Ranging: active ...
2017-09-05 19:28:59.907081+0100 Estimote Test[1691:498775] Region Ranging: active ...
2017-09-05 19:29:00.899307+0100 Estimote Test[1691:498775] Region Ranging: active ...
2017-09-05 19:29:01.901167+0100 Estimote Test[1691:498775] Region Ranging: active ...
Am I getting sth wrong about the concept of ranging? Should “didRangeBeacons” with normal behaviour not pick up that same beacon again? I tried with different beacons, always the same behaviour.
Thank you for a hint in the right direction!