我需要将iPhone的联系人访问到我的应用程序中。
我正在使用Xcode 7.2和IOS-9。给我最好的框架或库,这对我有用。
我尝试使用ABAddressbook框架,但它已被弃用。
谢谢。
苹果推出了新的框架Contacts和ContactsUI,用于访问iOS9及以上版本的联系人。
以前的ABAddressbook框架已被弃用。你可能会在SO中找到很多关于这方面的信息。
您可以使用iOS9+设备的ContactsUI框架
- (void) presentContacts
{
CNContactPickerViewController *contactPicker = [[CNContactPickerViewController alloc] init];
contactPicker.delegate = self;
[_myViewController presentViewController:contactPicker animated:YES completion:nil];
}
//Listen for delegates
- (void) contactPickerDidCancel: (CNContactPickerViewController *) picker
{
NSLog(@"didCancel");
}
- (void) contactPicker: (CNContactPickerViewController *) picker
didSelectContact: (CNContact *) contact
{
NSLog(@"didSelectContact"):
}
- (void) contactPicker: (CNContactPickerViewController *) picker
didSelectContactProperty: (CNContactProperty *) contactProperty
{
NSLog(@"didSelectProperty");
}
- CNContactPickerViewController
https://developer.apple.com/library/ios/documentation/ContactsUI/Reference/CNContactPickerViewController_Class/
- 通讯录ui框架
https://developer.apple.com/library/ios/documentation/AddressBookUI/Reference/AddressBookUI_Framework/index.html
-
MFMessageComposeViewControllerhttps://developer.apple.com/library/ios/documentation/MessageUI/Reference/MFMessageComposeViewController_class/
-
教程http://www.appcoda.com/ios-programming-import-contact-address-book/
-
http://gabriel-tips.blogspot.in/2012/02/how-to-import-contacts-from-address.html