App crash on use of PeoplePicker, but not in same view

前端 未结 3 1703
花落未央
花落未央 2021-01-12 19:20

Update 2, I hope this helps someone, there is a solutions at the following link: https://discussions.apple.com/thread/5498630?start=0&tstart=0 , evidently th

3条回答
  •  臣服心动
    2021-01-12 19:24

    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;
    }
    

提交回复
热议问题