如何使用 ABPeoplePicker 获取电子邮件?
我没有发现苹果的文档对于实际使用人员选择器获取数据非常有帮助,而且互联网上似乎没有太多其他信息:(我认为我需要在此功能中获取电子邮件:
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier
{
}
我可以放什么在那里获取所选人员的电子邮件?
I'm not finding Apple's documentation very helpful for actually getting data with a people picker, and there doesn't seem to be much other information on the internet :( I assume I need to get the email in this function:
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier
{
}
What can I put in there to get the email of the selected person?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
Kal 的答案实际上是不准确的 - 即因为“ABMultiValueCopyValueAtIndex”采用索引而不是标识符。
标识符值是静态的(如枚举)
因此,当所选人员仅存储 1 封电子邮件(即“工作电子邮件”)时,它会崩溃。由于标识符是“1”,但我们需要索引“0”。
幸运的是,我们可以使用以下来获取索引:
代码:
Kal answer is actually inaccurate - namely because "ABMultiValueCopyValueAtIndex" takes an index not identifier.
Identifier value is static (like enumeration)
So it will crash when the person selected only have 1 email stored, which is a "Work Email". Since the identifier is "1", but we need index "0".
Luckily we can use following to get the index:
Code: