由于我已将iPhone上的XCode(6.0,6A313)和我的iOS(8.0,12A365)更新为gm种子,因此ABPeoplePickerNavigationController代码不像以前那样工作.
iOS 7.1.2:如果有人想要导入联系人,则会打开地址簿,并且您会看到完整的联系人列表,选择一个联系人后,它会打开联系人的详细信息视图,而不是您可以通过单击电话添加联系人您要导入的号码.
iOS 8.0:它的一切都很相似,但如果你点击一个联系人的号码,它拨打电话号码而不是导入它.
码:
#pragma mark - AddressBook Delegate Methods
-(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person{
return YES;
}
-(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier{
// Get the first and the last name. Actually, copy their values using the person object and the appropriate
// properties into two string variables equivalently.
// Watch out the ABRecordCopyValue method below. Also, notice that we cast to NSString *.
NSString *firstName = (__bridge NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
NSString *lastName = (__bridge NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty);
// Compose …Run Code Online (Sandbox Code Playgroud)