How to set up WhatsApp with UIActivityViewController
for sharing image, not using UIDocumentInteractionController
. Please let me know if there is another way. Thanks in advance.
This is the code to share text and url from activity controller
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!", 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];
For Swift 3.0
let objectsToShare = ["\(Title) \n \(Description)"]
let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)
activityVC.setValue("App Name", forKey: "subject")
let excludeActivities = [UIActivityType.airDrop, UIActivityType.print, UIActivityType.assignToContact, UIActivityType.saveToCameraRoll, UIActivityType.addToReadingList, UIActivityType.postToFlickr, UIActivityType.postToVimeo, UIActivityType.postToFacebook, UIActivityType.message, UIActivityType.postToWeibo]
activityVC.excludedActivityTypes = excludeActivities
self.present(activityVC, animated: true, completion: { _ in })