如何判断mapkit是否无法获取用户位置?

发布于 2024-08-10 07:05:40 字数 84 浏览 1 评论 0原文

我想知道如果mapkit无法获取用户位置(无法在用户位置显示蓝色斑点)并显示警报,然后再次重新定位位置。我不想使用corelocation.plz帮助我。

I want to find that if mapkit failed to get user location(fails to show blue blob at user location) and show alert and then relocate the location again.i don't want to use corelocation.plz help me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

客…行舟 2024-08-17 07:05:40

您可以尝试使用被调用的委托方法来查看是否需要蓝点:


- (MKAnnotationView *) mapView: (MKMapView *)aMapView viewForAnnotation: (id )annotation 
{               
    if (annotation == aMapView.userLocation) 
    {
        return nil; // this might be the moment the location was first detected
    }
}

您可以假设仅在地图套件已知位置后才需要蓝点。但是,我认为这不是一个好主意,因为这些东西可能很容易在下一版本的 SDK 中损坏。

我建议使用核心位置。它相对易于使用,并为您提供长期的灵活性和稳定性。

You might try to use the delegate methods that gets called to see if the blue dot is being asked for:


- (MKAnnotationView *) mapView: (MKMapView *)aMapView viewForAnnotation: (id )annotation 
{               
    if (annotation == aMapView.userLocation) 
    {
        return nil; // this might be the moment the location was first detected
    }
}

You could assume that the blue dot is only asked for after the location is known to map kit. However, I think this would not be a good idea as those things might easily break in the next version of the SDK.

I would recommend to use Core Location. It is relatively easy to use and gives you all the flexibility and stability over the long run.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文