Locationmanager:Didenterregion Not Called When a Beacon Is Detected

Unable to detect iBeacons in iOS9. Keep getting CLRegionStateOutside

The problem is that the code is not looking for the proper ProximityUUID of the beacon. The 9B2D1BB8-25AA-8EE5-2513-7C140B6B1801 UUID in the code that originated from the Light Blue app is not a ProximityUUID needed to detect iBeacons.

Understand that there are many kinds of UUIDs. The Light Blue app will detect Bluetooth Service UUIDs but it will not detect iBeacon ProximityUUIDs. While the superficially look the same, they have different values and meanings. It may be that the Bluetooth Service UUID you scanned with Light Blue did originate from the beacon, but it still won't work in the code shown, because it isn't the correct ProximityUUID.

How do you figure out your beacon's ProximityUUID? A few options:

  1. Ask the manufacturer, or use the manufacturer's configuration utility.

  2. Use a dedicated beacon scanner for Android, OSX or Linux which lets you see any beacon regardless of the ProximityUUID. Unfortunately, iOS only lets you see beacons if you know the ProximityUUID up front.

Once you know the ProximityUUID, simply replace the value instead of the 9B2D1BB8-25AA-8EE5-2513-7C140B6B1801 shown.

iBeacon - can detect using startRangingBeacons but not for didEnterRegion

You are trying to change the UI in the location manager callback - that's a big no no since those callbacks are usually not on the main thread. Wrap each UI change in a dispatch block to the main thread and see if that changes anything.

Ah, I had the same issue a few days ago. You need to implement:

func locationManager(manager: CLLocationManager!, didChangeAuthorizationStatus status: CLAuthorizationStatus) {
println("STATUS CHANGED: \(status.rawValue)")
if status == .AuthorizedAlways && !monitoring {
println("YAY! Authorized!")
locationManager.startMonitoringForRegion(beaconRegion)
monitoring = true
}
}

You can only start monitoring AFTER the system tells you you have permission to.

Also, if you want background notifications, you MUST have this string in your Info.plist: NSLocationAlwaysUsageDescription, and you need the App registers for location updates defined in Required background modes.



Related Topics



Leave a reply



Submit