1先匯入標頭檔案

#import <ContactsUI/ContactsUI.h>

2遵循代理

<CNContactPickerDelegate>

3 開始方法

CNContactPickerViewController * contactVc = [CNContactPickerViewControllernew];

        contactVc.delegate = self;

        [selfpresentViewController:contactVc animated:YEScompletion:^{

        }];

4下面是代理方法

-(void)contactPicker:(CNContactPickerViewController *)picker didSelectContact:(CNContact *)contact{

NSLog(@"name:%@%@",contact.familyName,contact.givenName);

CNLabeledValue * labValue = [contact.phoneNumberslastObject];

NSLog(@"phone:%@",[labValue.valuestringValue]);

}

//取消選擇回撥

- (void)contactPickerDidCancel:(CNContactPickerViewController *)picker{

    [picker dismissViewControllerAnimated:YEScompletion:nil];

}