一.iOS9之前:AddressBookUI
的使用:
1.导入头文件,遵守协议
#import "ViewController.h"
#import <AddressBookUI/AddressBookUI.h>
@interface ViewController () <ABPeoplePickerNavigationControllerDelegate>
@end
2.创建选择联系人的控制器
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
// 1.创建选择联系人的控制器
ABPeoplePickerNavigationController *ppnc = [[ABPeoplePickerNavigationController alloc] init];
// 2.设置代理
ppnc.peoplePickerDelegate = self;
// 3.弹出控制器
[self presentViewController:ppnc animated:YES completion:nil];
}
3.实现代理方法