我尝试通过whatsapp从我的应用程序共享音频文件,但xcode显示错误:
var controller = UIDocumentInteractionController()
if UIApplication.sharedApplication().canOpenURL(NSURL(string:"whatsapp://app")!) {
var savePath = NSBundle.mainBundle().pathForResource("test", ofType:"mp3")
controller = UIDocumentInteractionController(URL:NSURL(fileURLWithPath:savePath!)!)
controller.UTI = "net.whatsapp.audio"
controller.delegate = self
controller.presentOpenInMenuFromRect(CGRectZero, inView: self.view, animated: true)
} else {
println("error")
}
***由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [__ NSCFTimer _openDocumentWithApplication:]:无法识别的选择器发送到实例0x17417c980'