Iphone MKMapView didUpdateUserLocation未更新
我有一个带有map的应用程序,希望在更新后缩放到当前位置 我使用Iphone MKMapView didUpdateUserLocation未更新,iphone,mkmapview,userlocation,Iphone,Mkmapview,Userlocation,我有一个带有map的应用程序,希望在更新后缩放到当前位置 我使用-(void)mapView:(MKMapView*)mapView didUpdateUserLocation:(MKUserLocation*)userLocation委托方法来知道何时更新了用户位置 现在在模拟器上,该方法被调用了。但当我在设备(iphone 2g)上测试时,位置会在地图上更新,但根本不会调用“didUpdateUserLocation”方法,委托方法“mapViewWillStartLocatingUser”
-(void)mapView:(MKMapView*)mapView didUpdateUserLocation:(MKUserLocation*)userLocation
委托方法来知道何时更新了用户位置
现在在模拟器上,该方法被调用了。但当我在设备(iphone 2g)上测试时,位置会在地图上更新,但根本不会调用“didUpdateUserLocation”方法,委托方法“mapViewWillStartLocatingUser”也是如此
系统询问我是否允许获取应用程序的位置,并开始显示我的位置,但
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation {
NSLog(@"didUpdateUserLocation = '%@'", userLocation);
}
从未调用。参考文献提到,此委托方法自iOS 4.0起可用。你的模拟器很可能运行的是iOS 4.0,而你的手机则是iOS 3.1
我也有同样的问题,仍然在寻找解决办法。也许直接访问CL方法会有所帮助。试试这个映射。showsUserLocation=YES 谢谢大家!!我从来没想过检查一下。我很高兴我帮了忙。我通过每隔一秒钟左右查询一次用户位置来解决这个问题。如果您能找到更好的解决方案,我将非常感谢您将其发布在此处:)