开发者

ABRecordRef vCard

开发者 https://www.devze.com 2022-12-21 02:45 出处:网络
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.

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

精彩评论

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