持续"允许" App"在您使用应用程序时访问您的位置"警报

时间:2016-08-23 19:27:36

标签: ios objective-c xcode8 xcode8-beta6

我开发了一个应用程序,我试图在委托方法中获取当前设备位置" applicationDidBecomeActive"它工作正常,但是当我在Xcode 8 beta 6和iOS beta 10.7上测试我的相同代码时出现了问题。屏幕被连续的警报轰炸,并且说#34;允许" App"在您使用应用程序时访问您的位置"。我无法点击"允许" /"不允许"。我的代码是:

-(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中编译应用程序并在iOS 9设备上成功运行 2)在Xcode8 beta6中编译了应用程序,并在iOS10设备上受到警报轰炸。

我试过谷歌搜索但没有运气。任何指针都非常受欢迎。

1 个答案:

答案 0 :(得分:0)

试试这个

转到info.plist

添加密钥

Privacy - Location Always Usage Description

Privacy - Location Usage Description

Privacy - Location When In Use Usage Description

在右侧添加说明。