【问题标题】:Continous "Allow "App" to access your location while you use the app" alerts连续“允许“应用程序”在您使用应用程序时访问您的位置”警报
【发布时间】:2016-08-23 19:27:36
【问题描述】:

我开发了一个应用程序,我试图在委托方法“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中编译App并在iOS 9设备上成功运行 2) 在 Xcode8 beta6 中编译 App 并在 iOS10 设备上被警报轰炸。

我试过用谷歌搜索它,但没有运气。任何指针都非常感谢。

【问题讨论】:

  • 可能需要在info.plist中添加使用说明
  • 你有没有想过这个问题?

标签: ios objective-c xcode8 xcode8-beta6


【解决方案1】:

试试这个

转到info.plist

添加键

Privacy - Location Always Usage Description

Privacy - Location Usage Description

Privacy - Location When In Use Usage Description

在右侧添加说明。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-08-05
    • 1970-01-01
    • 2012-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多