ABRecordRef vCard

I would like to convert a ABRecordRefto vCardor NSDatato transmit it via Bluetooth. I came across your question, and I wonder if you can understand how to do this.

thank

+3
source share
1 answer

Very simple, I work with iOS 6 and I did 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 NSArraywith elements ABRecordRef...

+7
source

Source: https://habr.com/ru/post/1734485/


All Articles