0
我開發了一個應用程序,我試圖獲取當前設備位置委託方法「applicationDidBecomeActive」,它工作正常,但問題來了當我在Xcode 8 beta 6和iOS beta 10.7上測試相同的代碼時。屏幕被持續的警報轟炸,說「允許」應用程序「在您使用應用程序時訪問您的位置」。我無法點擊「允許」/「不允許」。我的代碼是:連續「允許」應用程序「訪問您的位置,而您使用應用程序」警報
-(void) startLocationService {
CLAuthorizationStatus status = [CLLocationManager authorizationStatus];
if (![CLLocationManager locationServicesEnabled] || status == kCLAuthorizationStatusDenied || status == kCLAuthorizationStatusRestricted) {
DLog(@"Locations disabled or status not permiting use of locations systems.");
self.currentLocation = nil;
[self sendNotificationforErrorMessage:ERROR_MSG_LOCATION_SERVICE];
}
else {
[self createLocationManager];
if ([locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
if (status == kCLAuthorizationStatusNotDetermined) {
[locationManager requestWhenInUseAuthorization];
}
}
else {
[self startLocationManager];
}
}
}
-(void)createLocationManager {
self.currentLocation = nil;
locationManager = [[CLLocationManager alloc] init];
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
locationManager.delegate = self;
}
-(void)startLocationManager {
[locationManager startUpdatingLocation];
[self performSelector:@selector(locationServiceTimedout)
withObject:nil
afterDelay:timeOutValue];
}
情景我已經測試: 1)的編譯應用程序在Xcode8 beta6和的編譯應用程序在Xcode8 beta6的iOS 9設備 2)上成功運行,並且與iOS10設備上的警報得到了轟炸。
我試過Google搜索它,但沒有運氣。任何指針非常感謝。
也許你需要在info.plist中添加使用說明 – Ro4ch
你有沒有想過這個? – Ro4ch