iPhone MapKit 用户位置无效
我试图将地图视图的中心坐标设置为用户位置:
[self.mapView setCenterCoordinate:[[[self mapView] userLocation] coordinate]];
但是我遇到了崩溃,这与用户位置无效有关:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid Coordinate -180.00000000, -180.00000000'
以前有其他人遇到过此错误吗?或者你知道如何解决这个问题吗?
I am trying to set the mapView's center coordinate to be the users location:
[self.mapView setCenterCoordinate:[[[self mapView] userLocation] coordinate]];
However I am getting a crash which is to do with the user location being invalid:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid Coordinate -180.00000000, -180.00000000'
Has anyone else had this error before? Or do you know how to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,您需要获取
[[[[self mapView] userLocation] location] 坐标]
而不是 mapView 的 userLocation 坐标。Turns out you need to get the
[[[[self mapView] userLocation] location] coordinate]
rather than the mapView's userLocation's coordinate.