UIImage * imageShare = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:trackImagePath]]];
NSURL *urlLink = [NSURL URLWithString:linkstr];
SharingActivityProvider * share = [[SharingActivityProvider alloc]initWithPlaceholderItem:@"Ghaneely Share!"];
share.sharelink = urlLink;
share.sharelinkText = shareString;
NSArray *objectsToShare = @[imageShare,share];
activityVC = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];
NSArray *excludeActivities = @[UIActivityTypePostToWeibo,UIActivityTypePrint,UIActivityTypeSaveToCameraRoll,UIActivityTypeAssignToContact,UIActivityTypeAirDrop];
activityVC.excludedActivityTypes = excludeActivities;
[self presentViewController:activityVC animated:TRUE completion:nil];
我希望像使用text
一样在WhatsApp上分享image
和UIActivityController
(两者)。它曾经在我使用没有SharingActivityProvider
的共享之前工作。但是我需要在facebook,twitter等上发布不同的文本,因此我使用的是ActivityProvider
(我认为应该不是问题)。现在使用上面的代码,它只共享image
。
可能是什么问题?
答案 0 :(得分:1)
通过这种方式,您可以将文字和视频分享到whatsapp: -
NSString *URLString=@"http://video.app.com/video.php?";
NSURL *VideoURL=[NSURL URLWithString:@“URLString ”];
NSMutableArray *activityItems= [NSMutableArray arrayWithObjects:VideoURL,@"Hey, check out this video I've shared with you, it's awesome!", result1, nil];
self.activityViewController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
self.activityViewController.excludedActivityTypes = @[UIActivityTypePostToWeibo,UIActivityTypePrint,
UIActivityTypeCopyToPasteboard,UIActivityTypeAssignToContact,
UIActivityTypeSaveToCameraRoll,UIActivityTypeAddToReadingList,
UIActivityTypePostToFlickr,UIActivityTypePostToVimeo,
UIActivityTypePostToTencentWeibo,UIActivityTypeAirDrop];
[self presentViewController:self.activityViewController animated:YES completion:nil];
尝试这可能会对你有帮助。