我们可以从iPhone的联系人列表中访问emailids吗? [英] Can we access the emailids from the contactlist from iPhone?

查看:186
本文介绍了我们可以从iPhone的联系人列表中访问emailids吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以通过代码访问iPhone联系人列表中的每个联系人的所有电子邮件ID?

Can we access all the email IDs for each contact from the iPhone contactlist through code?

推荐答案

您将通过给定代码获取个人电子邮件ID ...

You will get the individual email ids by given code...

    ABAddressBookRef addressBook = ABAddressBookCreate();
    CFArrayRef people  = ABAddressBookCopyArrayOfAllPeople(addressBook);
    NSString *contactName = lblTitle.text;
    for(int i = 0;i<ABAddressBookGetPersonCount(addressBook);i++)
    {
        ABRecordRef person = CFArrayGetValueAtIndex(people, i);
        NSString *strEmail = [arContactData valueForKey:@"Email"];
        NSMutableArray *arEmailList = [[NSMutableArray alloc] init];
        ABMultiValueRef emails = ABRecordCopyValue(person, kABPersonEmailProperty);
        for(CFIndex idx = 0; idx < ABMultiValueGetCount(emails); idx++)
        {
            CFStringRef emailRef = ABMultiValueCopyValueAtIndex(emails, idx);
            NSString *strLbl = (NSString*)ABAddressBookCopyLocalizedLabel (ABMultiValueCopyLabelAtIndex (emails, idx));
            NSDictionary *dicTemp = [[NSDictionary alloc]initWithObjectsAndKeys:strEmail,@"value", strLbl,@"label", nil];  
            [arEmailList addObject:dicTemp];        
        }
    }

这篇关于我们可以从iPhone的联系人列表中访问emailids吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆