如何解决locationManager didUpdateLocations返回零坐标0,0
我正在开发一个可不断轮询用户位置的应用程序。在大多数设备上,返回到didUpdateLocations的位置是正确的,但在某些设备上,它是(0,0),尽管似乎一切都正确,例如权限,委托等。 didFailWithError永远不会被调用。 我只看到了几个这样的问题,但没有找到解决方案。 有什么想法吗?
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
spotGeofences = [NSMutableArray array];
[locationManager requestAlwaysAuthorization];
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
locationManager.activityType = CLActivityTypeOtherNavigation;
locationManager.pausesLocationUpdatesAutomatically = NO;
locationManager.allowsBackgroundLocationUpdates = YES;
locationManager.showsBackgroundLocationIndicator = TRUE;
- (void) locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
if ([CLLocationManager locationServicesEnabled])
[locationManager startUpdatingLocation];
}
- (void) locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)locations {
//Here I get (0,0) :[
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。