I would like to convert a ABRecordRef
into an vCard
or 开发者_开发技巧NSData
to transmit it via Bluetooth. I've run into your question and I wonder if you were able to figure out how to do it.
Thank you
Is very easy, I'm working with iOS 6 and I done with the following code:
ABRecordRef person = (__bridge ABRecordRef)[_ABRecordCards objectAtIndex:0];
ABRecordRef people[1];
people[0] = person;
CFArrayRef peopleArray = CFArrayCreate(NULL, (void *)people, 1, &kCFTypeArrayCallBacks);
NSData *vCardData = CFBridgingRelease(ABPersonCreateVCardRepresentationWithPeople(peopleArray));
NSString *vCard = [[NSString alloc] initWithData:vCardData encoding:NSUTF8StringEncoding];
NSLog(@"vCard > %@", vCard);
I have a NSArray
with ABRecordRef
elements...
精彩评论