Reputation:
I am developing a GPS application in which I need to track the speed of the device/iPhone.
I am using the CLCorelocation API's Locate me referral code provided by Apple. My problem is that the LocationManager
does not update the current latitude and longitude thus I am unable to calculate the distance as well as the speed of the device/iPhone.
Any kinds of suggestions/code will be highly appreciated please suggest if I can do something with the Mapkit framework introduced in the sdk 3.0.
Upvotes: 0
Views: 256
Reputation: 243
Check out apple's Core Location Framework Reference.
By implementing the CLLocationManagerDelegate
method locationManager:didUpdateToLocation:fromLocation
: you can receive latitude and longitude updates from your CLLocationManager
.
Also, since you're wanting to check the device's speed you'll probably want to set the distanceFilter
and desiredAccuracy
of your CLLocationManager
to kCLDistanceFilterNone
and kCLLocationAccuracyBest
respectively.
If you can get yourself a copy, Beginning iPhone Development has a chapter (#14) dedicated to using CoreLocation that I found beneficial. Lastly, although it is not focused on CoreLocation, Apple's tutorial on CoreData incorporates CoreLocation data which you may find useful.
Edit: Related question specific to calculating speed.
Upvotes: 1