我正在使用iBeacons,但遇到了一個小問題。CLLocationManager委託未調用
第一次使用時,用戶需要賦予權限,然後我們下面被稱爲:
_locationManager = [[CLLocationManager alloc] init];
_locationManager.delegate = self;
[_locationManager requestAlwaysAuthorization];
不過,我預計將稱爲以下的委託方法:
- (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];
}
}
我運行iOS 8.0.2,所以不知道這是否是一個錯誤
你是否設置了對locationManager的強引用,類似'@property(nonatomic,strong)CLLocationManager * locationManager;'? – 2014-10-10 18:36:48
不,但在全球範圍內在.h文件中聲明它。包含的類很強大,在appDelegate中定義。所有其他回調工作正常,只是這一個。 – 2014-10-10 19:16:36