deferredLocationUpdatesAvailable在iOS 10中返回NO [英] deferredLocationUpdatesAvailable returns NO in iOS 10
问题描述
我正在尝试使用一些CoreLocation功能,并且我遇到了延迟位置更新的问题。
I am trying to use some CoreLocation features, and I am running into problems with deferred location updates.
出于某种原因,为iOS 10更新了应用程序deferredLocationUpdatesAvailable总是返回NO。我在iPhone 6s上测试,所以我知道该设备能够使用GPS功能。
For some reason when the app was updated for iOS 10 deferredLocationUpdatesAvailable returns NO always. I am testing on an iPhone 6s, so I know that the device is capable of using GPS features.
我尝试使用它来调试:
[CLLocationManager deferredLocationUpdatesAvailable]
我无法弄清楚这是iOS 10的问题,还是我设置错误。
I can't figure out if this is an issue with iOS 10 or if I have something set incorrectly.
在这种方法中:
- (void)locationManager:(CLLocationManager *)manager didFinishDeferredUpdatesWithError:(NSError *)error {
self.deferringUpdates = NO;
NSLog(@"DEFERRING Error: [%@]", error);
if (error) {
[[LocationManagerClient alertWithMessage:error.localizedDescription andTitle:error.domain] show];
}
}
我最终记录了这个错误:
I end up logging this error:
DEFERRING Error: [Error Domain=kCLErrorDomain Code=11 "(null)"]
有没有其他人遇到iOS 10这个问题或者知道发生了什么?
Has anyone else run into this problem with iOS 10 or have any idea what is going on?
编辑:
这就是我设置距离过滤器的方法
This is how I am setting the distance filter
- (void)configureForApplicationWillResignActive {
[_locationManager setAllowsBackgroundLocationUpdates:YES];
[_locationManager setPausesLocationUpdatesAutomatically:NO];
[_locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[_locationManager setDistanceFilter:kCLDistanceFilterNone]; // use distance filter
[_locationManager requestAlwaysAuthorization];
}
- (void)configureForApplicationDidBecomeActive {
[_locationManager setAllowsBackgroundLocationUpdates:YES];
[_locationManager setPausesLocationUpdatesAutomatically:NO];
[_locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[_locationManager setDistanceFilter:kCLDistanceFilterNone]; // use distance filter
[_locationManager requestAlwaysAuthorization];
}
推荐答案
我已经提交了雷达(28303779)带有概念验证示例代码 - 还包含雷达的措辞。我还打开了一个开发论坛帖子,看来很多工程师都面临同样的问题问题。 deferredLocationUpdatesAvailable()
在iOS 10中也返回false。似乎苹果故意关闭了该功能。
I have already filed a Radar (28303779) with proof of concept sample code - also contains the wording from the radar. I have also opened a dev forum post and it appears a lot of engineers are facing the same problem. deferredLocationUpdatesAvailable()
is also returning false in iOS 10. Seems like apple has intentionally turned off the functionality.
更新
我的错误报告已关闭,说'它按预期工作'。我想苹果公司并不打算解决这个问题,并且在没有弃用的情况下错误地将其取出。
My Bug Report got closed saying 'it works as intended'. I suppose Apple does not intend to fix it and it was mistakenly taken out without deprecation first.
这篇关于deferredLocationUpdatesAvailable在iOS 10中返回NO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!