无法在iOS 8上选择联系人 [英] Cannot select contact on iOS 8

查看:120
本文介绍了无法在iOS 8上选择联系人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 ABPeoplePickerNavigationController 的子类来处理我的应用程序中的联系电话号码。 iOS 7及以下版本的所有功能都很棒。

I have a subclass of ABPeoplePickerNavigationController to handle selecting a contact phone number in my app. Everything works great on iOS 7 and below.

但是,在iOS 8上,我的 ABPeoplePickerNavigationControllerDelegate 不会受到影响选择一个电话号码。相反,它只是调用那个电话号码。

On iOS 8, however, my ABPeoplePickerNavigationControllerDelegate does not get hit when selecting a phone number. Instead, it just calls that phone number.

我注意到我用来处理iOS 7中的联系人选择的方法( peoplePickerNavigationController:shouldContinueAfterSelectingPerson: property:identifier:)在iOS 8中已弃用。此方法已被 peoplePickerNavigationController取代:didSelectPerson:property:identifier:

I noticed that the method I was using to handle contact selection in iOS 7 (peoplePickerNavigationController:shouldContinueAfterSelectingPerson:property:identifier:) was deprecated in iOS 8. This method was replaced by peoplePickerNavigationController:didSelectPerson:property:identifier:.

我知道我的委托已设置,因为我成功收到 peoplePickerNavigationControllerDidCancel:方法回调。

I know my delegate is set because I successfully receive the peoplePickerNavigationControllerDidCancel: method callback.

还有其他人遇到过这个问题吗?

Has anyone else experienced this issue?

这是我的 ABPeoplePickerNavigationController 子类的代码片段:

Here's a code snippet of my ABPeoplePickerNavigationController subclass:

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


推荐答案

你在哪里指定 peoplePickerDelegate

在iOS 8中,如果在 viewDidLoad peoplePickerDelegate >,您将体验到您描述的奇怪行为(取消委托工作, didSelect ... shouldContinue ... 不要)。如果您在 init (或期间)之后立即指定 peoplePickerDelegate ,它可以正常工作。

In iOS 8, if you specify peoplePickerDelegate in viewDidLoad, you will experience the curious behavior you describe (cancel delegate works, the didSelect... and shouldContinue... do not). If you specify peoplePickerDelegate immediately after init (or during), it works fine.

这似乎是iOS 8功能。我将提交错误报告。

This would appear to be an iOS 8 "feature". I'll file a bug report.

这篇关于无法在iOS 8上选择联系人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆