MKMapView loading failed

When loading MKMapView , I have a peculiar crash. The nature of the occurrence is when I open the ABPeoplePickerNavigationController in one view, which in turn calls the delegate method UINavigationController

And after saving / without saving, I switch to another view - this works fine. The next view is its working fine. But when I enter the view using MKMapView , it will work.

No other problems arise. Only the view that MKMapView loads falls with the following log

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

I commented on the part of the code loading mapview, and then it works fine. Thus, it seems that my navigation bar is freed up somewhere when the map loads. But what I cannot understand is that no other view in the application has problems, only with a mapview error. I tried various test patterns and made sure that none of the other views had any problems.

The application does not crash in the simulator. It crashes only on the device. Why this problem occurs only in the view that loads mapview and has no other views.

I tried profiling to analyze my problem. Here is what I found, but it is not very useful.

Profile -> Zombies

+8
ios iphone ios7 mkmapview uinavigationcontroller
source share
2 answers

I had the same problem.

This is a leak issue on ABPeoplePickerNavigationController. You must make sure that he will not be released.

I declare this as a strong property to ensure that it will not be released and it works fine :)

+4
source share

Well, there is a simpler solution for this. The actual problem is using ABPeoplePickerNavigationController as a singleton object, setting its delegate in the view controller and then removing the view controller. So, in my case, the solution that worked was:

  • (voids) peoplePickerNavigationControllerDidCancel: (ABPeoplePickerNavigationController *) peoplePicker {peoplePicker.peoplePickerDelegate = nil; // clear the delegate before rejecting itself [self.navigationController dismissViewControllerAnimated: YES termination: nil]; }

  • (BOOL) peoplePickerNavigationController: (ABPeoplePickerNavigationController *) peoplePicker shouldContinueAfterSelectingPerson: (ABRecordRef) people real estate: real estate (ABPropertyID) ID: (ABMultiValueIdentifier) ​​identifier {[self displayPerson: person]; peoplePicker.peoplePickerDelegate = nil; // clear the delegate before rejecting himself [self.navigationController dismissViewControllerAnimated: YES termination: nil]; refund NO; }

0
source share

All Articles