Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Agreed with @Matt, without more code the best solution I can offer is this to tell it to update every time the device is moved with:</p> <pre><code>[self.locationManager setDistanceFiler:kCLDistanceFilterNone] </code></pre> <p><strong>Update</strong></p> <p>I went through past projects and found the code I believe you are looking for assuming your location manager subclass is working properly</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; //Location // create new location manager self.locationManager = [[CLLocationManager alloc] init]; self.locationManager.delegate = self; self.locationManager.desiredAccuracy = kCLLocationAccuracyBest; self.locationManager.distanceFilter = kCLDistanceFilterNone; // start location manager [self.locationManager startUpdatingLocation]; } -(void) distanceBetweenUserandPin { CLLocation *currentUserLocation = [[CLLocation alloc] initWithLatitude:_currentLocation.latitude longitude:_currentLocation.longitude]; CLLocation *currentPinLocation = [[CLLocation alloc] initWithLatitude:_pinLocation.latitude longitude:_pinLocation.longitude]; CLLocationDistance distanceBetweenUserAndPinMeters = [currentUserLocation distanceFromLocation:currentPinLocation]; } - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{ //This successfully saves Lat, Long Data to a point location CLLocationCoordinate2D location = CLLocationCoordinate2DMake(newLocation.coordinate.latitude, newLocation.coordinate.longitude); NSLog(@"%f, %f", location.latitude, location.longitude); //This assigns the value of location to the ivar _currentLocation _currentLocation = CLLocationCoordinate2DMake(location.latitude, location.longitude); NSLog(@"%f, %f", _currentLocation.latitude, _currentLocation.longitude); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload