-2

I need to access the contacts of my iPhone into my app.

I am using Xcode 7.2 and IOS-9. Give me best framework or library which is usefully for me.

I try to work on the ABAddressbook framework but it has been deprecated.

Thank You.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
NAVEEN KUMAR
  • 669
  • 6
  • 25
  • possible duplicate of http://stackoverflow.com/questions/3747844/get-a-list-of-all-contacts-on-ios – iAnurag Dec 30 '15 at 08:37
  • Possible duplicate of [Fetch Contacts in iOS 7](http://stackoverflow.com/questions/19027118/fetch-contacts-in-ios-7) – Juri Noga Dec 30 '15 at 08:37
  • You can use Contacts and Contacts UI frameworks instead of ABAddressbook framework Read Deprecated APIs in [iOS 9.0](https://developer.apple.com/library/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS9.html). – Mehul Sojitra Dec 30 '15 at 09:43

2 Answers2

4

Apple has introduced new frameworks Contacts and ContactsUI for accessing contacts for iOS9 and above.

The previous ABAddressbook framework has been deprecated. You might find a lot of info in SO on this.

You can make use of ContactsUI framework for iOS9+ devices

- (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");
}
ipraba
  • 16,485
  • 4
  • 59
  • 58