开发者

ABRecordRef vCard

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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜