加载 MKMapView 时崩溃

Crash when loading MKMapView(加载 MKMapView 时崩溃)

本文介绍了加载 MKMapView 时崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在加载 MKMapView 时遇到了奇怪的崩溃.发生的模式是当我在一个视图中打开 ABPeoplePickerNavigationController 时,这又会触发 UINavigationController 委托方法

I am having a peculiar crash when loading MKMapView. The pattern of occurrence is when I open ABPeoplePickerNavigationController in one view, which in turn triggers the UINavigationController delegate method

在保存/不保存后,我转到另一个视图——它工作正常.下一个视图——它工作正常.但是当我使用 MKMapView 进入视图时,它会崩溃.

And after saving/without saving I move to another view--its working fine. Next view--its working fine. But when I enter the view with MKMapView, it crashes.

其他视图没有任何问题.只有加载 MKMapView 的视图会崩溃并显示以下日志

No other views are having any problem. Only the view which loads MKMapView crashes with the following log

*** -[UINavigationBar barStyle]: message sent to deallocated instance

我已经注释了代码中加载地图视图的部分,然后它工作正常.因此,当地图视图加载时,我的导航栏似乎在某处被释放.但我无法理解的是,应用程序中的其他视图没有任何问题,只有 mapview 崩溃的那个.我尝试了不同的测试模式,并确保其他视图都没有任何问题.

I have commented the part in the code which loads the mapview and then it works fine. So it seems that my navigation bar is deallocated somewhere, when the mapview loads. But what I cant understand is that, no other view in the app has any problem, only the one with mapview crashes. I have tried different patterns of testing and made sure that none of the other views are having any problems.

应用程序不会在模拟器中崩溃.它仅在设备上崩溃.为什么这个问题只在加载 mapview 的视图中出现,而在其他视图中没有.

The app doesn't crash in simulator. It crashes only on device. Why is this issue only in the view which loads mapview and in no other views.

我尝试通过分析来分析我的问题.这是我发现的,但没有太大帮助.

I tried profiling to analyze my problem. Here is what I found, but its not much helpful.

僵尸">

推荐答案

我也遇到了同样的问题.

I have had the same problem.

这是 ABPeoplePickerNavigationController 上的泄漏问题.你必须确保它不会被释放.

It's a leak issue on the ABPeoplePickerNavigationController. You have to ensure it won't be deallocated.

我将它声明为一个强大的属性,以确保它不会被释放并且可以正常工作:)

I'm declaring it as a strong property to ensure it won't be deallocated and it works fine :)

这篇关于加载 MKMapView 时崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:加载 MKMapView 时崩溃

基础教程推荐