I'm trying to convert Vcard/vcf information in the form of JSON to an NSData object. When I try to attach the NSData object, it's not displaying properly. Am I missing a conversion step between the JSON information and the NSData object?
if(args[@"attachments"][@"vcf"]){
NSArray *vCard = [RCTConvert NSArray:args[@"attachments"][@"vcf"]];
NSLog(@"%@", vCard);
NSError *error = nil;
NSData *data = [NSJSONSerialization dataWithJSONObject:vCard options:kNilOptions error:&error];
NSLog(@"%@", data);
NSString *contactIdentifier = @"kUTTypeVCard";
NSString *contactName = [RCTConvert NSString:args[@"attachments"][@"contactName"]];
[ mcvc addAttachmentData:data typeIdentifier:contactIdentifier filename:contactName];
}
Here is the JSON Object being passed into the state:
data: "BEGIN:VCARD↵VERSION:4.0↵FN:Matthew Marks↵EMAIL;TYP…quot;];PREF=1:Matthewmarks13@gmail.com↵END:VCARD↵"
This is the NSLog of the data:
<5b224245 47494e3a 56434152 445c6e56 45525349 4f4e3a34 2e305c6e 464e3a4d 61747468 6577204d 61726b73 5c6e454d 41494c3b 54595045 3d5b2671 756f743b 776f726b 2671756f 743b2c20 2671756f 743b696e 7465726e 65742671 756f743b 5d3b5052 45463d31 3a4d6174 74686577 6d61726b 73313340 676d6169 6c2e636f 6d5c6e45 4e443a56 43415244 5c6e225d>