如何获得用户位置的纬度和经度? [英] How do I get the users location latitude and longitude?

查看:161
本文介绍了如何获得用户位置的纬度和经度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用mainViewController中包含的此方法访问用户位置

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];
}

但是mainViewController已经设置为

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?

推荐答案

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

In your other question I already told you how to get the location, so:

-[CL位置坐标]

在发布问题之前查看文档永远不会感到伤害...

It never hurts to look in the documentation before posting questions...

这篇关于如何获得用户位置的纬度和经度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆