gpt4 book ai didi

iphone - MKMapView didUpdateUserLocation 未更新

转载 作者:行者123 更新时间:2023-12-03 21:11:16 25 4
gpt4 key购买 nike

我有一个带有 map 的应用程序,并且希望在更新时缩放到当前位置。

我使用 -(void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation 委托(delegate)方法来了解用户位置何时更新。

现在,模拟器方法正在按其应有的方式被调用。但是当我在设备(iphone 2g)上测试它时,位置在 map 上更新,但根本没有调用“didUpdateUserLocation”方法,委托(delegate)方法“mapViewWillStartLocatingUser”也是如此。

系统询问我是否允许获取应用程序的位置并开始显示我的位置,但是

- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation {
NSLog(@"didUpdateUserLocation = '%@'", userLocation);

}

从未被调用过。

最佳答案

引用文献提到此委托(delegate)方法自 iOS 4.0 起可用。您的模拟器很可能运行 iOS 4.0,而您的手机则运行 iOS 3.1。

我遇到了同样的问题,仍在寻找解决方案。也许直接访问 CL 方法会有所帮助。

关于iphone - MKMapView didUpdateUserLocation 未更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3165051/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com