How do I get the users location latitude and longitude?

Posted by kevin Mendoza on Stack Overflow See other posts from Stack Overflow or by kevin Mendoza
Published on 2010-06-17T22:10:06Z Indexed on 2010/06/17 22:13 UTC
Read the original article Hit count: 204

I need to access the users location in this method contained in the mainViewController

-(void)loadAnnotations{
[mapView removeAnnotations:mapView.annotations];

CLLocationCoordinate2D workingCoordinate;
workingCoordinate.latitude= //here i need the users latitude
workingCoordinate.longitude= //here i need the users longitude
NSLog(@" this is %@", workingCoordinate.latitude);
iProspectLiteAnnotation *tempMine = [[iProspectLiteAnnotation alloc] initWithCoordinate:workingCoordinate];
[tempMine setTitle:@"Present Location"];
[tempMine setAnnotationType:iProspectLiteAnnotationTypeUser];
[mapView addAnnotation:tempMine];
}

however the mainViewController is already set to

<fipsideViewControllerDelegate>

What should I add to the header file and the implementation file to poll the location Manager for the users current latitude and longitude?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone-sdk-3.0