汇悦台好还是天銮好:获取ios contacts(email) 地址
来源:百度文库 编辑:偶看新闻 时间:2024/04/28 09:21:55
Yes, you can do this. It seems suspicious that you would want to do this (why do you need this information?), but it isn't difficult to do.
You can use ABAddressBookCopyArrayOfAllPeople
to get an CFArrayRef with all of the people, and then you can query kABPersonEmailProperty
of each using ABRecordCopyValue
. The code would look something like this (untested):
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(addressBook);
NSMutableArray *allEmails = [[NSMutableArray alloc] initWithCapacity:CFArrayGetCount(people)];
for (CFIndex i = 0; i < CFArrayGetCount(people); i++) {
ABRecordRef person = CFArrayGetValueAtIndex(people, i);
ABMultiValueRef emails = ABRecordCopyValue(person, kABPersonEmailProperty);
for (CFIndex j=0; j < ABMultiValueGetCount(emails); j++) {
NSString* email = (NSString*)ABMultiValueCopyValueAtIndex(emails, j);
[allEmails addObject:email];
[email release];
}
CFRelease(emails);
}
CFRelease(addressBook);
CFRelease(people);
(Memory allocation may be a little off; it's been a while since I've developed Cocoa/Core Foundation code.)
But seriously, question why you are doing this. There's a good chance that there's a better solution by just using the Apple-provided APIs to present a contact picker at appropriate times.
推销自己的产品而想获取更多的个人EMAIL,谁有办法?
如何打开ios文件
如何打开IOS文件?
ios是什么东西??
如何保存ios
2950交换机IOS备份
刷B怎么IOS
nero5.5怎么做ios
路由器的IOS恢复问题?
寻字体素材IOS (bt)
cisco 2500 IOS 版本区别
Company H.R. Contacts中的H.R. 是什么意思
怎样在MSN Spaces主页上添加Live Contacts啊?
wants to study Chinese the foreigner contacts with me
怎么样在电脑上打开contacts.cdb文件
whicn是什么意思?love whicn contacts two person整句是什么意思?
Email是什么
关于EMAIL
有关EMAIL
EMAIL传情
email address
EMAIL问题
email 问题
打印email