0

I have a requirement where I need to make contacts favorite in the app itself. I have shown the contact book using the following code:

    CNContactPickerViewController *cVC = [[CNContactPickerViewController alloc] init];
    [self.view.window.rootViewController presentViewController:cVC animated:YES completion:nil];

Now I can see the contacts details but my question is how I can edit this contacts,Add this contacts as favourites.

Rahul gupta
  • 129
  • 8
  • Unless you are still trying to support iOS 8, the `if ([CNContactPickerViewController class])` line isn't needed. – rmaddy Sep 25 '18 at 04:50
  • Updated the question as I need to support ios 10 and above. – Rahul gupta Sep 25 '18 at 04:58
  • If you want a favourite contacts function inside your app, you’re going to have to keep track of them yourself. There’s no “favourites” api for you to use. Apps are expected to keep track of their own favourite contacts. But it should be simple to implement. Just maintain an array of CNContact identifiers. You can use a predicate with CNContactStore to fetch matching contacts later on. – Pete Morris Sep 25 '18 at 05:05
  • You may find this link helpful [https://stackoverflow.com/a/20621571/7019821] – Prashant Sep 25 '18 at 05:10

0 Answers0