I was manually adding an email id to an ABRecordRef which returns me an exception.Check out the code

ABRecordRef person=ABPersonCreate();

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

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

CFRelease(person);
有帮助吗?

解决方案

Try this.....

ABMutableMultiValueRef email = ABMultiValueCreateMutable(kABMultiStringPropertyType);
ABMultiValueAddValueAndLabel(email,(__bridge CFTypeRef)emailaddress,kABWorkLabel, NULL);
ABRecordSetValue(self.persons,kABPersonEmailProperty,email, NULL);
CFBridgingRelease(email);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top