title: How to find current location of user in mkmapview
body: <p>i want to find the current location of the user 
  below the code for finding coordinates from the well defined adress
   hom can i find the current location of the user ..please help me</p>
  
  <p>.h file
      #import 
      #import</p>
  
  <pre><code>@interface ViewController : UIViewController&lt;MKMapViewDelegate,CLLocationManagerDelegate&gt;
  @property(nonatomic,retain)  MKMapView *myMapView;
  @property (nonatomic, strong) CLGeocoder *myGeocoder;
  @end
  </code></pre>
  
  <p>.m file</p>
  
  <pre><code>#import "ViewController.h"
  #import &lt;CoreLocation/CoreLocation.h&gt;
  
  @interface ViewController ()
  {
      CLLocationManager *locationManager;
  }
  
  @end
  
  @implementation ViewController
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
  
  
      self.myMapView.showsUserLocation=YES;
  
      self.view.backgroundColor=[UIColor whiteColor];
      self.myMapView=[[MKMapView alloc]initWithFrame:self.view.bounds];
  
      self.myMapView.mapType=MKMapTypeHybrid;
      self.myMapView.autoresizingMask=UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
      [self.view addSubview:self.myMapView];
  
  
      locationManager = [[CLLocationManager alloc] init];
      locationManager.delegate=self;
      locationManager.desiredAccuracy=kCLLocationAccuracyBest;
      locationManager.distanceFilter=kCLDistanceFilterNone;
  
      [locationManager startUpdatingLocation];
  
     NSString *oreillyAddress =@"india";
    self.myGeocoder = [[CLGeocoder alloc] init];
      [self.myGeocoder
       geocodeAddressString:oreillyAddress completionHandler:^(NSArray *placemarks, NSError *error)
     {
          if ([placemarks count] &gt; 0 &amp;&amp; error == nil)
              {
         NSLog(@"Found %lu placemark(s).", (unsigned long)[placemarks count]);
               CLPlacemark *firstPlacemark = [placemarks objectAtIndex:0]; NSLog(@"Longitude = %f", firstPlacemark.location.coordinate.longitude); NSLog(@"Latitude = %f", firstPlacemark.location.coordinate.latitude);
  
  
           }
           else if ([placemarks count] == 0 &amp;&amp;
                    error == nil){ NSLog(@"Found no placemarks.");
          }
           else if (error != nil){
               NSLog(@"An error occurred = %@", error); }
       }];
  
  
      // Do any additional setup after loading the view, typically from a nib.
  }
  -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
  {
      return YES;
  }
  - (void)locationManager:(CLLocationManager *)manager
      didUpdateToLocation:(CLLocation *)newLocation
             fromLocation:(CLLocation *)oldLocation
  {
      float latitude=newLocation.coordinate.latitude;
      float longitude=newLocation.coordinate.longitude;
      NSLog(@"%f",latitude);
      NSLog(@"%f",longitude);
      [locationManager stopUpdatingLocation];
  
  }
  
  - (void)locationManager:(CLLocationManager *)manager
         didFailWithError:(NSError *)error
  {
      NSLog(@"error==&gt;%@",error);
  }
  - (void)didReceiveMemoryWarning
  {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  
  @end
  </code></pre>