title: Get current location on iOS
body: <p>I need to get current user location (latitude, longtitude), but I can not find a solution, because all solutions are just for iOS 6,7,8. For example, I have this code, but on iOS 11.3.1 it is still not working.</p>
  
  <pre><code>#import &lt;CoreLocation/CoreLocation.h&gt;
  
  @interface ViewController () &lt;CLLocationManagerDelegate&gt;
  
  @property (weak, nonatomic) IBOutlet UILabel *latitudeValue;
  @property (weak, nonatomic) IBOutlet UILabel *longtitudeValue;
  
  @property (nonatomic,strong) CLLocationManager *locationManager;
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
  
      if ([CLLocationManager locationServicesEnabled]) {
          self.locationManager = [[CLLocationManager alloc] init];
          self.locationManager.delegate = self;
          [self.locationManager startUpdatingLocation];
      } else {
          NSLog(@"Location services are not enabled");
      }
  }
  
  - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
  {
      CLLocation *location = [locations lastObject];
      self.latitudeValue.text = [NSString stringWithFormat:@"%f", location.coordinate.latitude];
      self.longtitudeValue.text = [NSString stringWithFormat:@"%f", location.coordinate.longitude];
  }
  </code></pre>