使用UIActivityViewController将.vcf共享给WhatsApp失败,显示插件net.whatsapp.WhatsApp.ShareExtension无效错误
使用UIActivityViewController共享图像或文本,但共享.vcf无法使用whatsapp(适用于邮件/消息/信使等)。
NSData *pVcfData = [CNContactVCardSerialization dataWithContacts:[NSArray arrayWithObject:pContact] error:&pError]; // creating contact data from CNContactVCardSerialization
NSURL *pFileURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:pFileNameWithAllowedCharacters]]; // wrote the data to file
NSError *pWriteError = nil;
if ([pVcfData writeToURL:pFileURL options:NSDataWritingAtomic error:&pWriteError])
{
NSArray *pActivityItems = @[pFileURL]; // passed the file URL as ActivityItem for UIActivityViewController
UIActivityViewController *pActivityVC = [[UIActivityViewController alloc] initWithActivityItems:pActivityItems applicationActivities:nil];
[pActivityVC setValue:pContactName forKey:@"subject"];
[self presentViewController:pActivityVC animated:YES completion:nil];
}
除了.vcf之外,还有其他方法可以与whatsapp共享联系吗?请分享任何建议。