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
23
votes
6 answers

Swift - CLGeocoder reverseGeocodeLocation completionHandler closure

What I'm trying to do is pass a CLLocation to the function getPlacemarkFromLocation which then uses the passed CLLocation through reverseGeocodeLocation to set the CLPlacemark? that will be returned. I'm having issues creating the completionHandler…
AaronDancer
  • 649
  • 1
  • 7
  • 22
22
votes
1 answer

put CLLocationCoordinate2D into CLLocation for Swift

I have a method I want to call however when I get back the center of the map, it is in CLLocationCoordinate2D type. How do I put the results of CLLocationCoordinate2D into CLLocation?
20
votes
5 answers

String to CLLocation latitude and Longitude

I have two strings representing latitude and longitude like: "-56.6462520", and i want to assign then to a CLLocation object to compare to my current location.I tried the following code but i get errors only: CLLocation * LocationAtual =…
Vinicius Albino
  • 743
  • 2
  • 8
  • 21
20
votes
10 answers

How to check if MKCoordinateRegion contains CLLocationCoordinate2D without using MKMapView?

I need to check if user location belongs to the MKCoordinateRegion. I was surprised not to find simple function for this, something like: CGRectContainsCGPoint(rect, point). I found following piece of code: CLLocationCoordinate2D topLeftCoordinate =…
Lukasz
  • 19,816
  • 17
  • 83
  • 139
19
votes
5 answers

How to measure the distance in meters between two CLLocations?

How can I get the distance in meters between two CLLocations? CLLocation doesn't provide any method to do it, it seeems.
Ilya Lapan
  • 1,103
  • 2
  • 12
  • 31
17
votes
5 answers

What does horizontalAccuracy exactly mean?

I am working on an iOS application using location services. Having a background in experimental physics, I am wondering what exactly horizontalAccuracy in a location found in locationManager:didUpdateToLocation:fromLocation: stands for. The…
Axel
  • 1,716
  • 1
  • 16
  • 28
16
votes
2 answers

Having trouble calculating accurate total walking/running distance using CLLocationManager

I'm trying to build an iOS app that displays the total distance travelled when running or walking. I've read and re-read all the documentation I can find, but I'm having trouble coming up with something that gives me an accurate total…
Daniel
  • 1,151
  • 1
  • 9
  • 15
15
votes
3 answers

CLGeocoder returning error : The operation couldn’t be completed. (kCLErrorDomain error 8.)

I am calling this function once I get the addressString: [[self geocoder] geocodeAddressString:addressString completionHandler:^(NSArray *placemarks, NSError *error) { if (error) { block(nil, nil, error); }…
tech savvy
  • 1,417
  • 4
  • 21
  • 42
14
votes
1 answer

ALAssetPropertyLocation not working on any iOS 4.0+ on 3gs iPhones but working perfectly on iPhone4

I've got an app with location services ENABLED (from settings etc), and I'm reading all the photos from my device using ALAssetsLibrary. It works perfectly on iPhone4 iOS 4.2.1, but the same code and the same assets DONT WORK on any 3gs any iOS…
Dado
  • 1,147
  • 1
  • 13
  • 31
14
votes
5 answers

Why the CLLocationManager delegate is not getting called in iPhone SDK 4.0?

This is the code that I have in my AppDelegate Class - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { CLLocationManager *locationManager = [[CLLocationManager alloc] init]; …
Biranchi
  • 16,120
  • 23
  • 124
  • 161
13
votes
3 answers

How to get Current Location with SwiftUI?

Trying to get current location with using swiftUI. Below code, couldn't initialize with didUpdateLocations delegate. class GetLocation : BindableObject { var didChange = PassthroughSubject() var location : CLLocation…
Görkem Aydın
  • 175
  • 1
  • 10
13
votes
1 answer

Convert String to CLLocationCoordinate2D in swift

using Firebase as my backend, I've got a series of strings that are latitude and longitude coordinates, how can I convert them to CLLocationCoordinate2D so that I can use them for annotations? Here is the code that gets the info from Firebase every…
Learnin
  • 1,221
  • 4
  • 15
  • 19
13
votes
4 answers

Show User Location in MapView

I'm writing an App with a mapView showing some Annotations. Now I want to show the User's current location in the mapView. I get the current Location using this code: - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray…
Christian Seiler
  • 1,130
  • 1
  • 13
  • 29
12
votes
6 answers

Convert decimal coordinate into degrees, minutes, seconds, direction

I have the following so far, but can't figure out a tidy way to get the direction letters in without a bunch of messy if statements. Any ideas? Ideally I'd like to extend the CLLocation class with a category to do this. -(NSString…
trapper
  • 11,716
  • 7
  • 38
  • 82
12
votes
2 answers

Continuous location update background iOS13

I am currently testing the background location mode in iOS 13, as I want to track the user´s location and motion (using the CMMotionManager) in the background. Therefore, I have my own (singleton) class handling the location tracking. I initialize…
mattll
  • 121
  • 1
  • 6
1
2
3
53 54