I know a new contact can be created in an iOS addressbook.
Is there a way to also flag that contact and set it as a 'Favorite' programmatically?
I know a new contact can be created in an iOS addressbook.
Is there a way to also flag that contact and set it as a 'Favorite' programmatically?
I am not aware of any public API for this. And it makes sense, since this is a very invasive action. You should not be doing this - the user should be doing it.
Favorite contacts vary from one app to the next -- it's not something that the AddressBook framekwork manages. Take a look at the Phone app, and then look at FaceTime; you'll see that the contacts in the favorite lists are different (unless you've set the same favorites in both apps, of course). The same is true of the "recent" category.
To implement a Favorites list in your own app, keep track of the record identifiers for the contacts that the user chooses as favorites in your app. You can use ABPeoplePickerNavigationController to easily let users choose contacts to add to your favorites list.