【发布时间】:2016-10-28 13:21:46
【问题描述】:
我正在我的应用程序中捕获图像,并通过按 RETRICA 中的共享按钮使用 WHATSAPP 共享它。但我没有找到任何方法来正确地做到这一点。我使用了 UIDocumentInteraction 但它没有用。我如何在 IOS8 中使用 WHATSAPP 的共享扩展来共享它。
我在使用 UIDocumentInteractionController 时遇到了这个异常。
'UIDocumentInteractionController:无效的方案(null)。仅支持文件方案。'
这是我的代码
let image = UIImage(named: "nature")
let path = NSHomeDirectory().stringByAppendingPathComponent("Documents/whatsAppTmp.wai")
UIImageJPEGRepresentation(image!, 100.0)?.writeToFile(path, atomically: true)
let documentInteractionController = UIDocumentInteractionController(URL: NSURL(string: path)!)
documentInteractionController.UTI = "net.whatsapp.image"
【问题讨论】:
-
你试过使用 UIActivityViewController 吗?