dIDFinishDeferredUpdatesWithError :Error Domain=kCLErrorDomain Code=11 “The operation Couldn’t be completed. (kCLErrorDomain error 11.)”
我使用以下代码:
- (DeviceAPI *) init { locationManager = [[CLLocationManager alloc] init]; [locationManager setDelegate:self]; [locationManager setDesiredAccuracy:kCLLocationAccuracyBest]; [locationManager startUpdatingLocation]; [locationManager allowDeferredLocationUpdatesUntilTraveled:(CLLocationdistance)100000 timeout:(NSTimeInterval)100000]; return self; }@H_403_20@而这个回调函数:
- (voID)locationManager: (CLLocationManager *) manager dIDFinishDeferredUpdatesWithError:(NSError *)error{ NSLog(@"dIDFinishDeferredUpdatesWithError :%@",[error description]);}@H_403_20@有帮助吗?
解决方法 根据适用于iOS 6.0 SDK的Apple Developer论坛,延迟位置更新仅适用于:>在iPhone 5硬件上
>运行iOS 6.0或更高版本
>所需精度设置为kCLLocationAccuracyBest或kCLLocationAccuracyBestForNavigation,因为这需要GPS芯片.没有手机数据的iPad没有GPS芯片.
>调用“startUpdatingLocation”方法
>等待位置更新以大约每秒1进入
>然后开始推迟更新见:https://devforums.apple.com/message/751974#751974
见文档:
allowDeferredLocationUpdates(untilTraveled:timeout:)
所以听起来你需要iPhone 5硬件,等待位置更新以1Hz的速度进入.
另外,正如另一张海报所提到的,您需要在委托中实现locationManager:dIDUpdateLocations:方法.
总结The most common place to call this [
allowDeferredLocationUpdates
] method is in your delegate’slocationManager(_:dIDUpdateLocations:)
method. After processing any
new locations,call this method if you want to defer future updates
until the distance or time criteria are met. If new events arrive and
your app is in the background,the events are cached and their
delivery is deferred appropriately.From 07002. I’ve added notes insIDe
[]
.以上是内存溢出为你收集整理的xcode – 如何使用延迟位置iOS 6?全部内容,希望文章能够帮你解决xcode – 如何使用延迟位置iOS 6?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)