How to get the contacts programmatically using Mon

2019-05-14 11:32发布

问题:

How to get the contacts in iPhone? I need to get all attributes from iPhone contacts. How to achieve programmatically using MonoTouch?

回答1:

Use ABAddressBook



回答2:

ABAddressBook iPhoneAddressBook = new ABAddressBook();

ABPerson[] Contacts = iPhoneAddressBook.GetPeople();

foreach (ABPerson item in Contacts) {

    ABMultiValue<NSDictionary> Contact  = item.GetPhones();

    foreach (ABMultiValueEntry<NSDictionary> cont in Contact) {
                // cont.Label  indicates the type ( home,work,etc)
        // get the contact via cont.Value

    } 
}