gpt4 book ai didi

iphone - 从 iPhone 地址簿获取电子邮件地址

转载 作者:行者123 更新时间:2023-12-03 20:37:20 24 4
gpt4 key购买 nike

我目前能够成功访问并从 peoplePickerNavigationController 获取数据,但我想做的是访问联系人的电子邮件地址,然后在联系人时关闭模式窗口名字被按下。

场景:

"Button is clicked to add a contact
AddressBook Modal Window slides into view
Name of Contact is pressed
If available, the contact's email address is stored in an array
Dismiss modal window"

我当前的代码包括:

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier {
ABMultiValueRef container = ABRecordCopyValue(person, property);
CFStringRef contactData = ABMultiValueCopyValueAtIndex(container, identifier);
CFRelease(container);
NSString *contactString = [NSString stringWithString:(NSString *)contactData];
CFRelease(contactData);

NSLog(@"Value is: %@", contactString);

[self dismissModalViewControllerAnimated:YES];
return NO;
}

最佳答案

这就是我所做的。

if(property == kABPersonEmailProperty) {
CFTypeRef prop = ABRecordCopyValue(person, property);
CFIndex index = ABMultiValueGetIndexForIdentifier(prop, identifierForValue);
NSString *email = (NSString *)ABMultiValueCopyValueAtIndex(prop, index);

...

CFRelease(prop);
[email release];
}

关于iphone - 从 iPhone 地址簿获取电子邮件地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1875135/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com