我想在whatsapp上共享视频,但是我遇到savePath nil错误。
我使用以下代码:
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];
我的错误在哪里?
这是Swift版本:
func sendVideo(videoName: String, senderView: UIView) {
let path = NSBundle.mainBundle().pathForResource(videoName, ofType:"m4v")!
let fileUrl = NSURL(fileURLWithPath: path)!
docController = UIDocumentInteractionController(URL: fileUrl)
docController.UTI = "net.whatsapp.movie"
docController.presentOpenInMenuFromRect(CGRectZero, inView: senderView, animated: true)
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句