i use this code to get gps data
- (void)locationUpdate:(CLLocation *)location {
locLabel.text = [location description];
}
the result look like this
<+38.76856432, +11.99454301> +/- 100.00m (speed ......)
when i trie this i have an error,
- (void)locationUpdate:(CLLocation *)location {
locLabel.text = [location altitude];}
error
Assigng to "NSString *" from incompatible type CLLocationDistance (aka double)
i want to get longitude too
You should be able to get latitude and longitude separately from location.coordinate.latitude
and location.coordinate.longitude
.
The altitude you are receiving may be invalid. Check the value in location.verticalAccuracy
. Per the documentation, "A negative value indicates that the altitude value is invalid." Same goes for location.horizontalAccuracy
to make sure the latitude and longitude values in location.coordinate are valid.