I\'m trying to use some fancy iBeacons without success, kCLAuthorizationStatusNotDetermined all time. According to other questions it\'s a requirement to add those keys to
Found, documented at forums and tested it's an Objective-C iOS 8 related bug. Same code written in Swift just works. Working swift code, delegate is call.
Add Core Location framework to Project Settings / Targets / Capabilities / Background Modes set "Location Updates" and "Uses Bluetooth LE Accessories" Add key at Info.plist NSLocationAlwaysUsageDescription
import CoreLocation
class ViewController: UIViewController, CLLocationManagerDelegate {
var locManager: CLLocationManager?
override func viewDidLoad() {
super.viewDidLoad()
self.locManager = CLLocationManager();
self.locManager!.delegate = self;
if (!CLLocationManager.locationServicesEnabled()) {
println("Location services are not enabled");
}
self.locManager!.requestAlwaysAuthorization();
self.locManager!.pausesLocationUpdatesAutomatically = false;
let uuidString = "" // My ibeacon string there
let beaconIdentifier = "myCompany"
let beaconUUID:NSUUID = NSUUID(UUIDString: uuidString)
let beaconRegion:CLBeaconRegion = CLBeaconRegion(proximityUUID: beaconUUID,
identifier: beaconIdentifier)
self.locManager!.startMonitoringForRegion(beaconRegion)
self.locManager!.startRangingBeaconsInRegion(beaconRegion)
self.locManager!.startUpdatingLocation()
}
Dialog appears OK