MKMapView 处置

发布于 2024-08-12 03:44:11 字数 638 浏览 2 评论 0原文

释放 MKMapView 后,我发生了奇怪的(?)崩溃。 MKMapView 是我的视图控制器中的子视图,在我从导航堆栈中删除该视图并释放它后,应用程序会因该堆栈而崩溃:

...
#4  0x34196dc8 in -[MKMapView(UserPositioningInternal) locationManagerFailedToUpdateLocation:withError:]
#5  0x3417030c in -[MKLocationManager _reportLocationFailureWithError:]
#6  0x3416de94 in -[MKLocationManager locationManager:didFailWithError:]
#7  0x3205f538 in -[CLLocationManager onClientEventLocation:]
#8  0x3205dd5c in -[CLLocationManager onClientEvent:supportInfo:]
...

处置我的视图时是否必须执行一些额外的步骤?

编辑:在控制器的 dealloc 方法中将 mapView.showsUserLocation 设置为 NO 似乎有帮助。问题仍然是——这是有意的行为吗?

I have a strange(?) crash after releasing MKMapView. MKMapView is a subview in my view controller and after I remove that view from navigation stack and release it application crashes with this stack:

...
#4  0x34196dc8 in -[MKMapView(UserPositioningInternal) locationManagerFailedToUpdateLocation:withError:]
#5  0x3417030c in -[MKLocationManager _reportLocationFailureWithError:]
#6  0x3416de94 in -[MKLocationManager locationManager:didFailWithError:]
#7  0x3205f538 in -[CLLocationManager onClientEventLocation:]
#8  0x3205dd5c in -[CLLocationManager onClientEvent:supportInfo:]
...

Do I have to perform some extra steps when dispose of my view?

Edit: setting mapView.showsUserLocation to NO in controller's dealloc method seems to help. Still the question is - is it intended behaviour?

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

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

发布评论

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

评论(1

要走就滚别墨迹 2024-08-19 03:44:11

在dealloc中,在释放mapView之前将其委托设置为nil。

此外,如果您正在使用 ReverseGeocoder 和 CLLocationManager 之类的东西,您可能会想做同样的事情。

In dealloc, before releasing the mapView set its delegate to nil.

In addition, if you are using things like the ReverseGeocoder and a CLLocationManager you'll probably want to do the same thing.

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