Ale*_*der 5 ios addressbookui ios8
我有一个子类ABPeoplePickerNavigationController来处理在我的应用程序中选择联系电话号码.iOS 7及更低版本的一切都很棒.
但是,在iOS 8上,我ABPeoplePickerNavigationControllerDelegate在选择电话号码时不会受到影响.相反,它只是拨打那个电话号码.
我注意到我在iOS 7中使用的用于处理联系人选择的peoplePickerNavigationController:shouldContinueAfterSelectingPerson:property:identifier:方法在iOS 8中已弃用.此方法已替换为peoplePickerNavigationController:didSelectPerson:property:identifier:.
我知道我的委托已设置,因为我成功收到peoplePickerNavigationControllerDidCancel:方法回调.
还有其他人遇到过这个问题吗?
这是我的ABPeoplePickerNavigationController子类的代码片段:
- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker didSelectPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier {
[self peoplePickerNavigationController:peoplePicker shouldContinueAfterSelectingPerson:person property:property identifier:identifier];
}
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier {
...do stuff...
return NO;
}
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person {
return YES;
}
- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker {
[self dismissViewControllerAnimated:self.shouldAnimateDismiss completion:NULL];
}
Run Code Online (Sandbox Code Playgroud)
你在哪里指定peoplePickerDelegate?
在iOS 8中,如果您指定peoplePickerDelegatein viewDidLoad,您将体验到您描述的奇怪行为(取消委托工作,didSelect...而shouldContinue...不是).如果您peoplePickerDelegate在init(或期间)之后立即指定,它可以正常工作.
这似乎是iOS 8"功能".我将提交错误报告.
| 归档时间: |
|
| 查看次数: |
4155 次 |
| 最近记录: |