Reputation: 3453
I've downloaded app for configuring beacons that I bought from Accent systems. It recognises beacon that is transmitting and I can easily configure it. I've used uuidgen tool to make some UUID for beacon and set it up in application. Let's say that this generated UUID is "XXX-XXX" (I know that it's longer and that it's HEX value). So, how it's set in my beacon is following:
UUID: XXX-XXX Major : 1111 Minor : 0001
That same UUID I used in my code. I've set my View Controller to CLLocationManagerDelegate
and in viewDidLoad
method I have following code:
NSUUID *myUUID = [[NSUUID alloc] initWithUUIDString:@"XXX-XXX"];
CLBeaconRegion *region = [[CLBeaconRegion alloc] initWithProximityUUID:myUUID
identifier:@"Company"];
CLLocationManager *locManager = [[CLLocationManager alloc] init];
[locManager setDelegate:self];
[locManager startRangingBeaconsInRegion:region];
I've also set following methods in that view controller, but they never get called:
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
- (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons
inRegion:(CLBeaconRegion *)region
I'm testing this on Ipad Air and bluetooth is ON.
Why do that never get called? What am I doing wrong?
Upvotes: 0
Views: 58
Reputation: 19800
You need to ask for location permission in iOS 8, and also added a the usage description string in your plist file.
Check out this answer for more detail: https://stackoverflow.com/a/24063578/361247
Upvotes: 2