【问题标题】:iOS 14 beta allow location once is going to locationManager didFailWithErroriOS 14 beta 允许定位一次去 locationManager didFailWithError
【发布时间】:2020-07-14 07:34:33
【问题描述】:

我正在 iOS 14 beta 上检查我的应用程序和位置权限如果我选择允许位置一旦它进入 Location failedWithError 方法并且错误对象是

Domain=kCLErrorDomain Code=0 "(null)", error.localizedDescription 是 操作无法完成。 (kCLErrorDomain 错误 0。)

-(void)loadFetchLocationDetails
{
    if (locationManager == nil)
        locationManager = [[CLLocationManager alloc] init];
    
    locationManager.delegate = self;
    locationManager.desiredAccuracy = kCLLocationAccuracyBest;
    
    if ([locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
        [locationManager requestWhenInUseAuthorization];
    }
    [locationManager startUpdatingLocation];
    [locationManager startMonitoringSignificantLocationChanges];
}


#pragma mark - CLLocationManagerDelegate Method

- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)locations
{

}

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{

}

谁能帮我解决这个问题。

【问题讨论】:

  • 这是一个测试版。向 Apple 提交雷达。

标签: ios objective-c location cllocationmanager ios14


【解决方案1】:

您好像忘记启用“位置模拟”。

按如下方式启用:

  • 转到产品
  • 方案
  • 编辑方案
  • 选项
  • 必须选中允许位置模拟,尝试提供默认位置,不要将其设置为“无”

然后重启XCode,问题应该就解决了。

【讨论】:

  • 在 iOS 13 上完全可以正常工作。在 iOS 14.0 中不行
猜你喜欢
  • 2012-10-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-09-13
  • 1970-01-01
  • 2021-03-08
相关资源
最近更新 更多