Raon
Raon

Reputation: 1286

how to set email id to an ABRecordRef object

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

ABRecordRef person=ABPersonCreate();

NSString *email=@"[email protected]";

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

CFRelease(person);

Upvotes: 1

Views: 475

Answers (1)

Francis F
Francis F

Reputation: 3285

Try this.....

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

Upvotes: 1

Related Questions