使用网址方案直接将图像分享到WhatsApp



我想在我的应用程序中集成WhatsApp共享,但我不想使用UIDocumentInteractionController。有什么方法可以使用url scheme共享图像吗?就像我们使用以下代码使用 URL 方案共享文本一样

var whatsappURL:NSURL?= NSURL(string: "whatsapp://send?text=Hello%2C%20World!")
if (UIApplication.shared.canOpenURL(whatsappURL)) {    
UIApplication.shared.openURL(whatsappURL) 
}

我认为你做不到。

首先,Whatapps仅支持通过URLScheme发送文本。其次,如何将图像放入urlString中?将其转换为base64string?

只能使用 UIDocumentInteractionController 发送图像

最新更新