Crash when loading MKMapView

前端 未结 2 2077
無奈伤痛
無奈伤痛 2021-02-06 05:28

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

相关标签:
2条回答
  • 2021-02-06 06:03

    Well, there is also a bit more simple solution to this. The actual problem is in using ABPeoplePickerNavigationController as a singleton object, setting its delegate to a view controller and then dismissing the view controller. So, in my case the solution that worked is this one:

    • (void)peoplePickerNavigationControllerDidCancel: (ABPeoplePickerNavigationController *)peoplePicker { peoplePicker.peoplePickerDelegate = nil; // clear delegate prior to dismissing self [self.navigationController dismissViewControllerAnimated:YES completion:nil]; }

    • (BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier { [self displayPerson:person]; peoplePicker.peoplePickerDelegate = nil; // clear delegate prior to dismissing self [self.navigationController dismissViewControllerAnimated:YES completion:nil]; return NO; }

    0 讨论(0)
  • 2021-02-06 06:05

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

    0 讨论(0)
提交回复
热议问题