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
5
votes
4 answers

Calculating Distance between two coordinates using CLLocation

I'm using CLLocationDistance to get the distance between two points, but I'm getting an error when passing my current location in it. CLLocation *current = [[CLLocation alloc] initWithLatitude:startLocation.coordinate.latitude…
user3007919
5
votes
2 answers

Can we Relaunch the application in the background on location change? after force quit it from background

I have the requirement that if my app is terminated from the background mode and after that if any significant location change occurs it should start in the background mode. That is what is exactly stated in the documents of…
Heena
  • 2,348
  • 3
  • 32
  • 58
5
votes
3 answers

Can I get the accuracy of GPS location in iOS?

I've seen Android developers get the accuracy of a GPS location. Is there a way that I can get the accuracy of my currenct GPS location in iOS? I am using the code from this answer to get my location: locationManager = [[CLLocationManager alloc]…
SirRupertIII
  • 12,324
  • 20
  • 72
  • 121
5
votes
2 answers

iOS: CLLocationManager's didEnterRegion not called

I have successfully managed to register a region or monitoring, I know this because the didStartMonitoringForRegion method was fired. I have a simple test app with one MKMapView where I can see my current location, I also have my region drawn on the…
PaulG
  • 6,920
  • 12
  • 54
  • 98
5
votes
5 answers

CLLocationManager sometimes stops updating while app is in background

I have an app which uses CLLocationManager to track the user's route, drawing dots along the path taken. The app runs in the background using Required background modes > App registers for location updates. As I understand, anything that happens in…
beev
  • 1,197
  • 2
  • 16
  • 33
5
votes
2 answers

Sending 'NSNumber *__strong' to parameter of incompatible type 'CLLocationDegrees' (aka 'double')

NSNumber * latitude = [NSNumber numberWithDouble:[[cityDictionary valueForKeyPath:@"coordinates.latitude"]doubleValue]]; NSNumber * longitude = [NSNumber numberWithDouble:[[cityDictionary…
milof
  • 696
  • 9
  • 25
5
votes
1 answer

recieving location updates after app is terminated

I need to keep track of the user location all the time (but not drain the battery). I understand the only way to get updates after app is terminated is using startMonitoringSignificantLocationChanges. From Apple's Location Awareness Programming…
Liatz
  • 4,997
  • 7
  • 28
  • 33
5
votes
2 answers

Getting Altitude(height from sea level) of my location in iphone SDK

I am trying to get Altitude of my location in my application. But every time I try altitude property of CLLocation object I am getting 0.00 as result. I googled for my query and I got a similar question here and here. This link is saying that if I…
Kapil Choubisa
  • 5,152
  • 9
  • 65
  • 100
4
votes
0 answers

How to solve std::bad_alloc exception swift iOS?

I need accurate location. To achieve the goal I have used like the below logic: I am trying to check updated location is to be accurate, if it is accurate then return it. But sometimes app does not receive accurate location(especially inside forest…
Shohin
  • 519
  • 8
  • 11
4
votes
3 answers

Calculating trip distance core location swift

I have an application where I calculate distance travelled like the Uber application. When a driver starts a trip, the location begins to change even though a start point has been specified in the search for a ride, a driver could decide to pass an…
King
  • 1,885
  • 3
  • 27
  • 84
4
votes
1 answer

How to properly get user coordinates?

I make a MapViewController adopt the CLLocationManagerDelegate protocol this way: extension MapViewController:CLLocationManagerDelegate{ func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { …
user5273262
4
votes
0 answers

CLLocationManager monitoredRegions causing crashes on iOS 12

We are using CLLocationManager monitoredRegions in our code using a function public func getMonitoredRegions() -> Set { return locationManager.monitoredRegions } And we are using this function in this way for region in…
AmineG
  • 1,908
  • 2
  • 27
  • 43
4
votes
1 answer

Print Array By Location shows up empty

The objective is this: Calculate the lat and long of each item in my array Append the lat and long to an array Print all items in the array in the max distance. Here is how I'm pulling data in: import Foundation import SwiftyJSON class restaurant…
4
votes
1 answer

Running CLLocation when Application is in background

How is it possible to keep CLLocation updating in the background. I believe you need to register the application to do this in the Application delegate but I can not find a reference to this anywhere?
jodm
  • 2,607
  • 3
  • 25
  • 40
4
votes
2 answers

Store location data using Core Data

I was wondering what approach is recommended for storing an array of CLLocation objects (forming a route or path) in a Core Data database? Is serialization a good approach or would you recommend to store the CLLocation objects in a separate model…
Bart Jacobs
  • 9,022
  • 7
  • 47
  • 88