1

I am making google map integration in iphone. I have to show current location showing in map. How will i get current location ?

Thanks

Ajay_Kumar
  • 1,381
  • 10
  • 34
  • 62

4 Answers4

5
CLLocationCoordinate2D location = [[[mapview userLocation] location] coordinate];  
NSLog(@"Location found from Map: %f %f",location.latitude,location.longitude);
Naveed
  • 41,517
  • 32
  • 98
  • 131
Rams
  • 1,721
  • 12
  • 22
3

Search for Accessing the Device’s Current Location in following article:

Related SO posts:

Community
  • 1
  • 1
Naveed
  • 41,517
  • 32
  • 98
  • 131
3

I think the question has been answered -

CLLocationCoordinate2D location = [[[mapview userLocation] location] coordinate];  
NSLog(@"Location found from Map: %f %f",location.latitude,location.longitude);

place this in the viewdidappear:animated

then you should find that you have the right location. Doing it any sooner and the location won't be set yet and you'll probably end up in the ocean :)

Bo Persson
  • 90,663
  • 31
  • 146
  • 203
Simon
  • 31
  • 1
1

The short answer is to write code like mapview.showsUserLocation = YES;, where mapview is your UIMapView class object.

  • No any above code is working well. These all are redirecting to same place an dthat place are not belongs to my place. – Ajay_Kumar Jun 09 '11 at 13:06