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:
Ask the manufacturer, or use the manufacturer's configuration utility.
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
Get Pixel Value from Cvpixelbufferref in Swift
React-Native Run-iOS Can Not Find Any Simulator
Region Monitoring Glitch on iOS 7 - Multiple Notifications at the Same Time
Get User Profile Details (Especially Email Address) from Twitter in iOS
Why Force Unwrapping Is Required in Case of Enum and Switch
Swift 3 JSON Nsfastenumerationiterator Has No Subscript Members
How to Use Local-Only Project via Cocoapods
Flutter: Cocoapods's Specs Repository Is Too Out-Of-Date to Satisfy Dependencies
Swift 3.0 Result of Call Is Unused
How to Use Both Google+ and Facebook Login in Same Appdelegate.Swift
Ios: One Ibaction for Multiple Buttons
Apple Llvm 6.0 Error: Clang Failed with Exit Code -1
Is It Ok to Place Most Logic and Models in the Appdelegate
How to Save Created PDF in Document Folder and Merge in iOS
Set Text Color and Font for Uidatepicker in iOS8/Swift