我刚刚注意到升级到 iOS9 后我的应用程序出现了不同的行为。我有一个显示手机设备联系人的 View 。
我的代码如下:
if (... == YES)
{
ABRecordSetValue(aContact, kABPersonEmailProperty, email, &anError);
if (anError == NULL)
{
ABUnknownPersonViewController *picker = [[ABUnknownPersonViewController alloc] init];
picker.unknownPersonViewDelegate = self;
picker.displayedPerson = aContact;
picker.allowsAddingToAddressBook = YES;
picker.allowsActions = YES;
picker.alternateName = @"John Appleseed";
picker.title = @"John Appleseed";
picker.message = @"Company, Inc";
[self.navigationController pushViewController:picker animated:YES];
}
然后我使用委托(delegate)来做一些决定
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person
property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier
{
//make decisions
return YES or NO;
}
用户点击电话号码。
在IOS8>> 代码到达shouldContinueAfterSelectingPerson然后出现原生拨号器
在 IOS9 中>> native 拨号器出现在代码到达 shouldContinueAfterSelectingPerson 之前。
有什么办法可以解决吗?
最佳答案
我也遇到了同样的问题。我注意到的是,如果您在委托(delegate)方法中进行某些计算(显然需要一些时间来进行该计算)并且会调用 native 拨号器。
所以,为了避免这个问题,我立即从这个委托(delegate)方法返回 NO 并在不同的线程中执行我的计算。这当然是一种解决方法,希望该问题在下一个 iOS 版本中得到解决。
关于在调用 shouldPerformDefaultActionForPerson 之前显示 iOS9 native 拨号程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32887251/