在我的应用程序中,我使用UIActivityViewController在Whatsapp,Facebook和Twitter等中共享文本.
我在iOS 9和Xcode Version 7.2中工作.
当我点击Whatsapp图标并点击特定联系人进行共享时,弹出以下警报视图:
当我单击“确定”时,我在调试窗格中收到以下警告:
plugin net.whatsapp.WhatsApp.ShareExtension invalidated
我还在.plist文件中将LSApplicationQueriesSchemes设置为whatsapp但它不起作用.
我想在所有共享选项中共享文本,而无需任何自定义控件.
提前致谢.
解决方法
我有这个问题..它最有可能是通过使用NSString而不是NSURL,这是一个工作代码:
- -(void) share {
- NSString* shareText = @"Sharing an eddress with you";
- NSURL *website = [NSURL URLWithString:@"http://eddress.co/EDDRSS"];
- NSArray *shareArray = @[shareText,website];
- UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:shareArray applicationActivities:nil];
- [activityVC setValue:@"Someone shared an eddress with you" forKey:@"subject"];
- NSArray *excludeActivities = @[UIActivityTypeAirDrop,UIActivityTypePrint,UIActivityTypeAssignToContact,UIActivityTypeSaveToCameraRoll,UIActivityTypeAddToReadingList,UIActivityTypePostToFlickr,UIActivityTypePostToVimeo];
- activityVC.excludedActivityTypes = excludeActivities;
- [self.navigationController presentViewController:activityVC animated:YES completion:nil];
- }