我只能共享一个图像。如何在whatApp上从我的应用程序共享多个图像

时间:2015-09-11 11:25:29

标签: ios

这是我的代码:

if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"whatsapp://app"]]){

        UIImage     * iconImage = [UIImage imageNamed:@"IMG_0087.PNG"];
        NSString    * savePath  = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/whatsAppTmp.wai"];

        [UIImageJPEGRepresentation(iconImage, 1.0) writeToFile:savePath atomically:YES];

       self. documentationInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:savePath]];
      self.  documentationInteractionController.UTI = @"net.whatsapp.image";
      self.  documentationInteractionController.delegate = self;

        [self.documentationInteractionController presentOpenInMenuFromRect:CGRectMake(0, 0, 0, 0) inView:self.view animated: YES];


} else {
        UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"WhatsApp not installed." message:@"Your device has no WhatsApp installed." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];
}

0 个答案:

没有答案