简体   繁体   English

iOS 6和Mapkit:用户位置

[英]iOS 6 and Mapkit : User location

I was suprise when i saw that my app can't know where I am located with a MapKit on iOS6 ! 当我看到我的应用程序无法通过iOS6上的MapKit知道我的位置时,我感到很惊讶!

I just want to zoom to user's location when the map is starting ! 我只是想在地图开始时缩放到用户的位置! How can I do it ? 我该怎么做 ?

Please help me 请帮我

Thank you so much !! 非常感谢 !! (PS: I saw that the CLCoordinate for sending a request for routing is working fine) (PS:我看到用于发送路由请求的CLCoordinate工作正常)

Do you mean that showsUserLocation doesn't have any effect? 你的意思是showsUserLocation没有任何影响吗? Or does your location monitoring isn't updating you position? 或者您的位置监控没有更新您的位置? I tested both in iOS 6, works for me. 我在iOS 6中测试过,对我有用。 Maybe you could post some code. 也许你可以发布一些代码。

EDIT: 编辑:

Seems like location monitoring is not activated in your app. 似乎位置监控未在您的应用中激活。 First of all you have to do sth like this to enable the cllocation manager: 首先,你必须这样做才能启用cllocation manager:

if (nil == locationManager)
    locationManager = [[CLLocationManager alloc] init];

//set the delegate for the location manager
locationManager.delegate = self;
// set your desired accuracy
locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;

[locationManager startUpdatingLocation];

At that point the blue location indicator should be visible. 此时,蓝色位置指示器应该是可见的。 As long as you've set showsUserLocation = YES on your map. 只要您在地图上设置showsUserLocation = YES即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM