如何与Swift共享.m4a文件到whatsapp?

时间:2015-04-05 16:04:33

标签: ios swift audio share whatsapp

我想与whatsapp共享一个.m4a文件,但我不明白我该怎么做?

这是我的代码。

var controller = UIDocumentInteractionController()

if UIApplication.sharedApplication().canOpenURL(NSURL(string:"whatsapp://app")!) {

    var savePath = NSBundle.mainBundle().pathForResource("test", ofType:"m4a")

    controller          = UIDocumentInteractionController(URL:NSURL(fileURLWithPath:savePath!)!)
    controller.UTI      = "net.whatsapp.audio"
    controller.presentOpenInMenuFromRect(CGRectZero, inView: self.view, animated: true)

}
else {
    println("error")
}

0 个答案:

没有答案