如何使用MonoTouch c#以编程方式获取联系人?

时间:2011-03-23 12:10:46

标签: c# iphone xamarin.ios contacts

如何在iPhone中获取联系人?我需要从iPhone联系人获取所有属性。如何使用MonoTouch以编程方式实现?

2 个答案:

答案 0 :(得分:4)

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

    } 
}

答案 1 :(得分:1)