Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Crash when loading MKMapView

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

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.

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

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.

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.

Profile --> Zombies

like image 650
Xavi Valero Avatar asked Dec 19 '13 16:12

Xavi Valero


1 Answers

I have had the same problem.

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 :)

like image 100
LeChatNoir Avatar answered Oct 05 '22 22:10

LeChatNoir