Reputation: 22633
So, as of iOS 6, -locationManager:didUpdateToLocation:fromLocation:
is deprecated.
Apple suggests, instead, using -locationManager:didUpdateLocations:
, which provides anywhere from one to a series of recent location changes. However, in the incredibly likely chance it provides a locations
array of length 1, there appears to be no way to access the fromLocation:(CLLocation *)oldLocation
parameter of old.
Is there a way to get at this information without using deprecated methods?
Upvotes: 2
Views: 952
Reputation: 438457
As rdelmar said, if you need the previous location, I would just store the last location received from locationManager:didUpdateLocations:
in an ivar or property, and if locationManager:didUpdateLocations:
returns an array with only one value, grab the value you previously saved in your ivar/property and use that for your "old" location.
Upvotes: 0
Reputation: 104092
You just need to set a property to the value that locationManager:didUpdateLocations: returns, which you can use as the fromLocation, and then call the method again, and use what it returns as the toLocation.
Upvotes: 1