vCardSerialization
用于在 vCard 和 AddressBook 记录之间进行编码和解码,遵循 Foundation 类 NSJSONSerialization
的 API 规范。
@import AddressBookUI;
#import "vCardSerialization.h"
NSURL *URL = [[NSBundle mainBundle] URLForResource:@"contact" withExtension:@"vcf"];
NSData *data = [NSData dataWithContentsOfURL:URL];
ABPersonViewController *viewController = [[ABPersonViewController alloc] init];
viewController.displayedPerson = (__bridge ABRecordRef)[[vCardSerialization addressBookRecordsWithVCardData:data error:nil] firstObject];
ABPeoplePickerNavigationController *navigationController = [[ABPeoplePickerNavigationController alloc] initWithRootViewController:viewController];
[self.navigationController presentViewController:navigationController animated:YES completion:nil];
NSArray *records = ...;
NSDate *data = [vCardSerialization vCardDataWithAddressBookRecords:records error:nil];
Mattt Thompson
vCardSerialization 在 MIT 许可证下可用。请参阅 LICENSE 文件获取更多信息。