I want to insert the value returning from mapView.userLocation.location.coordinate.longitude into my sqlite3 database. I am not sure of its type. I cannot do it this way:
<The documentation for MKUserLocation shows that the location property is of type CLLocation. The docs for CLLocation show that the coordinate property is of type CLLocationCoordinate2D.
The Core Location Data Types Reference shows that CLLocationCoordinate2D is a struct containing latitude and longitude each of which is of type CLLocationDegrees.
On the same page, CLLocationDegrees is shown to be just another name for double
. So latitude and longitude are of type double.
So instead of using sqlite3_bind_text
, use sqlite3_bind_double
:
sqlite3_bind_double(stmt, 1, mapView.userLocation.location.coordinate.longitude);
and to load the value, you would use something like:
double longitude = sqlite3_column_double(stmt, column_index_here);