如何获取用户位置的纬度和经度?

kev*_*oza -2 objective-c core-location iphone-sdk-3.0

我需要访问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];
}
Run Code Online (Sandbox Code Playgroud)

但是mainViewController已经设置为

<fipsideViewControllerDelegate>
Run Code Online (Sandbox Code Playgroud)

我应该在头文件和实现文件中添加什么来轮询位置管理器以获取用户当前的纬度和经度?

Dav*_*ong 5

在你的另一个问题中,我已经告诉你如何获取位置,所以:

-[CLLocation coordinate]

在发布问题之前查看文档绝不会受到伤害......