2014-12-05 177 views
0

我想知道如何在什么应用上共享多个媒体文件。 如果已经有相同的问题,请指导我。 这里是我使用的文本此代码非常适用于发送文本代码,在WhatsApp上共享多媒体文件(音频/视频/图像)

- (void)WhatsAppClicked 
{ 
    NSString *textwithTitle=[NSString stringWithFormat:@"-%@\n\n%@",LS_detailTitleLabel.text,LS_detailTextView.text]; 
    NSString *textURL=[NSString stringWithFormat:@"whatsapp://send?text=%@",textwithTitle];//make string 
    textURL=[textURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];//now make string look like URL 
    NSURL *whatsappURL = [NSURL URLWithString:textURL];//now pass it into URL 
    if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) 
    { 
     [[UIApplication sharedApplication] openURL: whatsappURL]; 
    } 
    else 
    { 
     UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"WhatsApp Error...!" message:@"WhatsApp Might not installed on your phone.Install it and try again" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
     [alert show]; 
    } 
} 

。 在此先感谢。

回答

0

试试这个代码共享您的图像

这里image_share是要分享

-(void)whatsappShare 
{ 
if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"whatsapp://app"]]) 
{ 
    UIImage *iconImage = image_share; 
    NSString * savePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/whatsAppTmp.wai"]; 

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

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

    [_documentInteractionController presentOpenInMenuFromRect:CGRectMake(0, 0, 0, 0) inView:self.view animated: YES]; 
} 
else 
{ 
    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"WhatsApp not installed." message:@"Please Install WhatsApp Application to share" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Continue",nil]; 
    [alert show]; 
} 
} 
+0

请在多个共享提供指导你的形象。 – Vats 2014-12-05 07:42:35

+0

对不起大桶,我对此没有任何想法 – Velu 2014-12-05 08:04:38