如何在没有UIactivityViewcontroller和UIDocumentInteractionController的情况下直接在whatsapp中共享gif?

时间:2017-02-27 09:03:41

标签: ios objective-c

我想在没有UIactivityViewcontroller和UIDocumentInteractionController的情况下在whatsapp中共享gif,是否可以直接共享gif?怎么样?提前谢谢。

NSString * urlWhats = [NSString stringWithFormat:@"whatsapp://send?image=%@",GIFPathToShare];
NSURL * whatsappURL = [NSURL URLWithString:[urlWhats stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

// this is identify if whatsapp is already install your device , if yes it open the whatsapp and share the content
if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
    [[UIApplication sharedApplication] openURL: whatsappURL];
} else {

    // it shows the alert for no application found
    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"WhatsApp not installed." message:@"Your device has no WhatsApp installed." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
}

0 个答案:

没有答案