didUpdateLocations代替didUpdateToLocation

didUpdateLocations代替didUpdateToLocation,第1张

didUpdateLocations代替didUpdateToLocation

假设您使用以下代表来担任最后职务?

- (void)locationManager:(CLLocationManager *)manager     didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation

上面的委托在iOS 6中已弃用。现在应使用以下委托:

- (void)locationManager:(CLLocationManager *)manager      didUpdateLocations:(NSArray *)locations

为了获得最后的位置,只需获得数组的最后一个对象:

[locations lastObject]

换句话说,

[locations lastObject]
(新委托)等于
newLocation
(旧委托)。



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5642206.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存