Questions tagged [cllocation]

A CLLocation object represents the location data generated by a CLLocationManager object. This object incorporates the geographical coordinates and altitude of the device’s location along with values indicating the accuracy of the measurements and when those measurements were made. In iOS, this class also reports information about the speed and heading in which the device is moving.

A CLLocation object represents the location data generated by a CLLocationManager object. This object incorporates the geographical coordinates and altitude of the device’s location along with values indicating the accuracy of the measurements and when those measurements were made. In iOS, this class also reports information about the speed and heading in which the device is moving.

Typically, you use a CLLocationManager object to create instances of this class based on the last known location of the user’s device. You can create instances yourself, however, if you want to cache custom location data or get the distance between two points.

This class is designed to be used as is and should not be subclassed.

https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocation_Class/CLLocation/CLLocation.html#//apple_ref/doc/uid/TP40007126

810 questions
4
votes
1 answer

How to use iPhone method -(CLLocationDistance)distanceFromLocation:(const CLLocation *)location

I am a new iPhone developer learning Objective-C, and am trying to dynamically calculate the distances between the users latitude/longitude coordinates, with latitude/longitude coordinates in a SQLite table. I know that we can use CLLocations…
syedfa
  • 2,801
  • 1
  • 41
  • 74
4
votes
0 answers

CLLocation course property is not updating and always with -1 value

I am developing an application where we should be tracking a vehicle. However, the course property in CLLocation always has a -1 value, although longitude and latitude are correct. My desired accuracy is kCLLocationAccuracyBestForNavigation Any…
4
votes
1 answer

Zooming GMSMapView to fit GMSMarker markers?

I was expecting from that code, he will place all the markers on the map and zoom GMSMapView to fit all my GMSMarker, I use for this includingCoordinate method from class GMSCoordinateBounds, but it doesn't work as i want. My example: #import…
4
votes
2 answers

swift ios9: Trying to start MapKit location updates without prompting for location authorization

I write a easy example for mapView suing swift, but I get the print Trying to start MapKit location updates without prompting for location authorization. Must call -[CLLocationManager requestWhenInUseAuthorization] or -[CLLocationManager…
rose
  • 241
  • 5
  • 16
4
votes
4 answers

Converting CLLocationCoordinate2D to a String that can be stored

I'm trying to save the coordinates of a user while in one ViewController so that it can be used to create an Annotation that can displayed in another ViewController. In the view controller that stores the coordinates I'm using the code…
Trip Phillips
  • 430
  • 1
  • 5
  • 18
4
votes
2 answers

Distance between Long Lat coord using SQLITE

I've got an sqlite db with long and lat of shops and I want to find out the closest 5 shops. So the following code works fine. if(sqlite3_prepare_v2(db, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) { while…
munchine
  • 479
  • 1
  • 9
  • 23
4
votes
3 answers

How to get latitude and longitude of a user's location in iOS

I am a new in Swift and I need to get the current location of a user. I mean that I need to get latitude and longitude. I have tried this: class ViewController: UIViewController, CLLocationManagerDelegate{ let locationManager =…
ZverArt
  • 235
  • 1
  • 4
  • 13
4
votes
5 answers

iBeacon major and minor value inside didEnterRegion

I'm trying to access the major and minor values for the closest beacon within the didEnterRegion delegate. However, when printing the values to the console they return null - (void)locationManager:(CLLocationManager *)manager…
user3626407
  • 287
  • 1
  • 6
  • 15
4
votes
2 answers

Objective C / iPhone comparing 2 CLLocations /GPS coordinates

have an app that finds your GPS location successfully, but I need to be able to compare that GPS with a list of GPS locations, if both are the same , then you get a bonus. I thought I had it working, but it seems not. I have 'newLocation' as the…
Kiksy
  • 1,272
  • 5
  • 20
  • 43
4
votes
2 answers

Detect when optimal location accuracy is reached with CLLocationManager

I'm currently working on an app that uses CLLocationManager with the lowest accuracy (kCLLocationAccuracyThreeKilometers). However, once every couple minutes I need to get an accurate location of the user, so I set the accuracy to…
Joost
  • 173
  • 3
  • 7
4
votes
1 answer

CLLocationDegrees with an expression of incompatible type 'double'

The topic says everything. why i get this error message at this 2 lines? NSArray *coordinates = [locationDetails[@"coordinates"] componentsSeparatedByString:@","]; CLLocationDegrees *lat = [coordinates[1] doubleValue]; //here is the red arrow…
CTSchmidt
  • 1,155
  • 3
  • 17
  • 30
4
votes
3 answers

why did didupdatelocation be called when device is not moved

i use CLLocation for a app that record people's trace in map view when they are running or walking ,but i found when my device is still (not moved) ,the - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations …
ximmyxiao
  • 2,622
  • 3
  • 20
  • 35
3
votes
1 answer

iphone - What consumes less battery? StartmonitoringLocationsChanges or startmonitoringforregion?

I would like you to give me your feedback on which method consumes less battery. My app will run in the background and will wake up with location changes, so I would like to use the method that consumes less battery. Any ideas on which one it…
subharb
  • 3,374
  • 8
  • 41
  • 72
3
votes
1 answer

Updating MKMapView to CLPlacemark returned from CLGeocoder

I want to be able to update the region displayed on a MKMapView by allowing the user to type in an address or location in a UIAlertView. I currently have: if (geocoder.geocoding) [geocoder cancelGeocode]; [geocoder…
brendan
  • 1,705
  • 1
  • 18
  • 24
3
votes
0 answers

How to get the distance traveled at a certain location in a HKWorkout

Goal I am currently trying to get the data to plot an elevation chart for a HKWorkout. I want the X-axis to represent distance and the Y-axis to represent elevation. This sort of graph is fairly common and acts as a sort of cross section of a…
bencallis
  • 3,478
  • 4
  • 32
  • 58