我想显示用户位置的蓝色脉冲点。我这样做:如何在mapkit中显示用户位置?
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
//some other stuff here
[self.mapView setShowsUserLocation:YES];
}
但我最终得到
-[MKUserLocation establishment]: unrecognized selector sent to instance 0x125e90
我应该这样做一些其他的方式?
- 编辑 -
我也这样做,这是我最终得到了上面的异常:
- (MKAnnotationView *) mapView:(MKMapView *)_mapView viewForAnnotation:(AddressNote *) annotation{
if(annotation.establishment != nil){
//do something}
建立一个自定义类,我有AddressNote。当建立有价值时,发生异常。如果我没有设置ShowsUserLocation,一切正常,但当然,我没有看到用户的位置。
谢谢。我现在在viewDidLoad中做这件事,但得到相同的异常。我已经更新了这个问题以反映更多的细节。如果我没有设置位置,它工作正常。 – 4thSpace 2010-03-14 20:31:46
我建议你将它分解为一个裸露的MKMapView并在其上设置相关选项。跳过注释和CLLocationManager的东西,事件处理等。当你有这个工作时,开始加入其余的部分,当问题再次出现时,你对它的位置有更好的了解。 – 2010-03-14 20:47:51