I just implement a simple application with Swift. Everything works except the invocation of the delegate method "beaconManager(manager: ESTBeaconManager!, didRangeBeacons beacons: [AnyObject]!, inRegion region: ESTBeaconRegion!)". I also compared it with the example code in the official repository, which is working with my beacons. Is this a known issue or is there a simple workaround for this? For the sake of completeness, I build my application with Xcode 6.1 for iOS 8.
Hey Pascal—do you call requestWhenInUseAuthorization or requestAlwaysAuthorization before starting ranging? You also need a NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription in your Info.plist file.
You can find more about what these things are here:
Hey Piortr, you saved my day ;) I've forgotten to set the keys in the info.plist file. Everything works now :) Many thanks for the fast response.
I'm running into the same problem in Objective-C. The delegate method never gets called and I made sure the beacon is properly emitting. Can you let me know if I did something wrong with the following code:
self.beaconManager = [[ESTBeaconManager alloc] init]; self.beaconManager.delegate = (id<ESTBeaconManagerDelegate>)self; self.beaconManager.avoidUnknownStateBeacons = NO; [self.beaconManager requestAlwaysAuthorization]; NSUUID* defaultBeaconId = [[NSUUID alloc] initWithUUIDString:@"B9407F30-F5F8-466E-AFF9-25556B57FE6D"]; ESTBeaconRegion* region = [[ESTBeaconRegion alloc] initWithProximityUUID:defaultBeaconId identifier:@"Apartment"]; [self.beaconManager startRangingBeaconsInRegion:region];
I assume, that you set the keys in the info.plist. What is your authorization state after requesting always authorization? Sometimes it is helpful to delete the application on the iPhone or iPad.
https://github.com/datboitom/BeaconPractice is the GitHub if it helps. The authorization state is kCLAuthorizationStatusAuthorized, haven't gotten the delegate method to call yet.