Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattt/vCardSerialization
Encodes and decodes between vCard files and AddressBook records.
https://github.com/mattt/vCardSerialization
Last synced: 3 months ago
JSON representation
Encodes and decodes between vCard files and AddressBook records.
- Host: GitHub
- URL: https://github.com/mattt/vCardSerialization
- Owner: mattt
- License: mit
- Archived: true
- Created: 2014-04-01T14:26:14.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-06-13T17:05:47.000Z (over 5 years ago)
- Last Synced: 2024-07-19T18:18:03.062Z (4 months ago)
- Language: Objective-C
- Size: 1.1 MB
- Stars: 69
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# vCardSerialization
> This library is no longer maintained.
> In iOS 9.0+ and macOS 10.11+,
> use [`CNContactVCardSerialization`](https://developer.apple.com/documentation/contacts/cncontactvcardserialization) instead.`vCardSerialization` encodes and decodes between [vCard](http://en.wikipedia.org/wiki/VCard) and [AddressBook](https://developer.apple.com/library/ios/documentation/AddressBook/Reference/AddressBook_iPhoneOS_Framework/_index.html) records, following the API conventions of Foundation's `NSJSONSerialization` class.
## Usage
### Decoding
```objective-c
@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];
```### Encoding
```objective-c
NSArray *records = ...;
NSData *data = [vCardSerialization vCardDataWithAddressBookRecords:records error:nil];
```---
## License
MIT
## Contact
Mattt ([@mattt](https://twitter.com/mattt))