2

I am using iBeacons, but am running into a small problem.

On first use the user needs to give permission, we then following is called:

_locationManager = [[CLLocationManager alloc] init];
_locationManager.delegate = self;
[_locationManager requestAlwaysAuthorization];

However, I expected the following delegate method to be called:

- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
    NSLog(@"Auth status changed: %i", status);
    if(status > 3){
        // Check if we have to start monitoring beacons
        NSLog(@"Do we need to initialise after auth given?");
        //[self initialiseLocations];
    }
}

I am running iOS 8.0.2, so not sure if this is a bug

Luuk D. Jansen
  • 4,402
  • 8
  • 47
  • 90
  • Did you set a strong reference to locationManager, something like `@property (nonatomic, strong) CLLocationManager *locationManager;`? – Dino Tw Oct 10 '14 at 18:36
  • No, but have it declared in the .h file, so globally. The containing class is strong, defined in the appDelegate. All other callbacks work fine, just this one. – Luuk D. Jansen Oct 10 '14 at 19:16

1 Answers1

0

This answer might help... it solved it for me at least. Also this website was a good walkthrough for this issue as well.

It looks like you are calling the requestAlwaysAuthorization correctly, but do you call startUpdatingLocation anywhere? Also, double check that in your Info.plist you have the appropriate key and string value added (NSLocationAlwaysUsageDescription since you're using requestAlwaysAuthorization).

Community
  • 1
  • 1
c_rath
  • 3,618
  • 2
  • 22
  • 14
  • I have those set, and it works fine otherwise (I use it for iBeacons, so don't need to start startUpdatingLocation, as that is for GPS). That is why I need the callback, so I can initiate the request to track the beacons. – Luuk D. Jansen Oct 10 '14 at 18:53
  • Oh, I've never used iBeacons so I'm not entirely sure then... I did a quick search however and found [this tutorial](http://ibeaconmodules.us/blogs/news/14279747-tutorial-ibeacon-app-development-with-corelocation-on-apple-ios-7-8) over using them and it states that they made edits to it to work with iOS 8 so maybe it will help? – c_rath Oct 10 '14 at 19:41