在 whatsapp 上分享视频 - 目标 c [英] Share video on whatsapp - objective c
本文介绍了在 whatsapp 上分享视频 - 目标 c的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 iOS 7.1.1 上,我可以通过这个代码在 Whatsapp 上分享图片..
On iOS 7.1.1, I can share image by this code on Whatsapp..
if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"whatsapp://app"]]){
UIImage * iconImage = [UIImage imageNamed:@"image.png"];
NSString * savePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/whatsAppTmp.wai"];
[UIImageJPEGRepresentation(iconImage, 1.0) writeToFile:savePath atomically:YES];
self.docController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:savePath]];
self.docController.UTI = @"net.whatsapp.image";
self.docController.delegate = self;
//[self.docController setAnnotation:@{@"WhatsappCaption" : @"https://itunes.apple.com/us/app/epic-ar/id535122470?ls=1&mt=8"}];
[self.docController presentOpenInMenuFromRect:CGRectMake(0, 0, 0, 0) inView:appDelegate.window.rootViewController.view animated: YES];
}
但我也想分享视频,我按照 Wahtsapp 教程
But I want to share video too, I follow tutorial on Wahtsapp tutorial
但是视频路径的代码怎么可能呢?
But How can be the code of video path ?
我的意思是,显示视频的 UIImage 对象的替代对象是什么?
I mean, What is the alternative object of UIImage object to display video ?
另外,我可以分享链接"吗?
Also, can I share "Link" ?
谢谢,
推荐答案
我花了一段时间,但我把各个部分放在一起
It took me a while, but I put the pieces together
参考:在 iOS 中通过 WhatsApp 分享图像/文本应用//http://www.whatsapp.com/faq/en/iphone/23559013
//---NEXT LINE OF CODE IS OPTIONAL AND NOT RECOMMENDED, BUT YOU CAN USE IT TO TEST TO SEE IF THEY HAVE THE WHATSAPP INSTALLED
// if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"whatsapp://app"]]){
NSString * savePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/whatsAppTmp.wam"];
savePath = [[NSBundle mainBundle] pathForResource:@"Movie" ofType:@"m4v"];
_documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:savePath]];
_documentInteractionController.UTI = @"net.whatsapp.movie";
_documentInteractionController.delegate = (id)self;
[_documentInteractionController presentOpenInMenuFromRect:CGRectMake(0, 0, 0, 0) inView:self.view animated: YES];
这只是为了回答您的主要问题:在 whatsapp 上分享视频
This is only to answer your main question: Share video on whatsapp
这篇关于在 whatsapp 上分享视频 - 目标 c的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文