title: IOS CLLocationManager is returning latitude: 0.000000 longitude: 0.000000
body: <p>I have been trying to get the current location IOS8 and following thread <a href="https://stackoverflow.com/questions/24062509/location-services-not-working-in-ios-8">Location Services not working in iOS 8</a> but getting the 00.00,00.00 instead current location. Any suggestion on where I am doing wrong.</p>
  
  <p>ViewController.h</p>
  
  <pre><code> #import &lt;UIKit/UIKit.h&gt;
   #import &lt;CoreLocation/CoreLocation.h&gt;
  
   #define IS_OS_8_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] &gt;= 8.0)
  
   @interface ViewController : UIViewController &lt;CLLocationManagerDelegate&gt;
  
   @property (strong, nonatomic) CLLocationManager *locationManager;
  
  @end
  </code></pre>
  
  <p>ViewController.m</p>
  
  <pre><code>#import "ViewController.h"
  
  @interface ViewController ()
  
  @end
  
  @implementation ViewController
  
   - (void)viewDidLoad {
  
  self.locationManager = [[CLLocationManager alloc] init];
  self.locationManager.distanceFilter = kCLDistanceFilterNone;
  self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
  [self.locationManager startUpdatingLocation];
  NSLog(@"%@", [self deviceLocation]);
  
  
  CLLocation *location = [self.locationManager location];
  
  // Configure the new event with information from the location
  CLLocationCoordinate2D coordinate = [location coordinate];
  
  NSString *latitude = [NSString stringWithFormat:@"%f", coordinate.latitude];
  NSString *longitude = [NSString stringWithFormat:@"%f", coordinate.longitude];
  
  
  NSLog(@"%@",latitude);
  NSLog(@"%@",longitude);
  
  [super viewDidLoad];
  </code></pre>
  
  <p>}</p>
  
  <pre><code> - (void)didReceiveMemoryWarning {
  [super didReceiveMemoryWarning];
  // Dispose of any resources that can be recreated.
  </code></pre>
  
  <p>}</p>
  
  <pre><code> -(void)setUpMap
   {
  self.locationManager = [[CLLocationManager alloc] init];
  self.locationManager.delegate = self;
  #ifdef __IPHONE_8_0
  if(IS_OS_8_OR_LATER) {
      // Use one or the other, not both. Depending on what you put in info.plist
      [self.locationManager requestAlwaysAuthorization];
  }
  #endif
  [self.locationManager startUpdatingLocation];
  
   }
  
  
  
   -(NSString *)deviceLocation 
   {
     return [NSString stringWithFormat:@"latitude: %f longitude: %f",         self.locationManager.location.coordinate.latitude, self.locationManager.location.coordinate.longitude];
   }
    - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
   {
     [manager stopUpdatingLocation];
  
  CLLocationCoordinate2D coordinate_currentlocation = [newLocation coordinate];
  
  float latitude_current = newLocation.coordinate.latitude;
  float longitude_current = newLocation.coordinate.longitude;
  
  
  NSLog(@"%f",latitude_current);
  NSLog(@"%f",longitude_current);
  
  NSLog(@"Current latitude :%f",coordinate_currentlocation.latitude);
  NSLog(@"Current longitude :%f",coordinate_currentlocation.longitude);
  } 
  @end
  </code></pre>
  
  <p>I have also added the following key in my info.plist</p>
  
  <pre><code>&lt;key&gt;NSLocationAlwaysUsageDescription&lt;/key&gt;
  &lt;string&gt;Your location is needed for this app.&lt;/string&gt;
  </code></pre>