如何将电子邮件ID设置为ABRecordRef对象

时间:2013-08-06 07:54:09

标签: ios abrecordref

我手动将电子邮件ID添加到ABRecordRef,这会给我一个异常。查看代码

ABRecordRef person=ABPersonCreate();

NSString *email=@"adsasdads@sadad.com";

ABRecordSetValue(person,kABPersonEmailProperty,(__bridge CFTypeRef)email,NULL);

CFRelease(person);

1 个答案:

答案 0 :(得分:1)

试试这个......

ABMutableMultiValueRef email = ABMultiValueCreateMutable(kABMultiStringPropertyType);
ABMultiValueAddValueAndLabel(email,(__bridge CFTypeRef)emailaddress,kABWorkLabel, NULL);
ABRecordSetValue(self.persons,kABPersonEmailProperty,email, NULL);
CFBridgingRelease(email);