我假设您使用以下代表来担任最后职务?
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
上面的委托在iOS 6中已弃用。现在应使用以下委托:
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
为了获得最后的位置,只需获得数组的最后一个对象:
[locations lastObject]
换句话说,
[locations lastObject](新委托)等于
newLocation(旧委托)。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)