我正在共享我的应用程序中的firebase
动态链接,该链接包含图像,描述和URL。当我直接在Twitter
,Facebook
,Messenger
上共享或与UIActivityViewController
共享时,它将显示图像,描述,URL。但是,当我在Whatsapp
上共享相同的链接时,它将仅显示url,描述而不显示图像。
fileprivate func shareLinkOnWhatsapp(url : URL){
let urString = url.absoluteString
let urlStringEncoded = urString.addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlQueryAllowed)
let url = URL(string: "whatsapp://send?text=\(urlStringEncoded!)")
if UIApplication.shared.canOpenURL(url!) {
UIApplication.shared.open(url!, options: [:]) { (success) in
if success {
print("WhatsApp accessed successfully")
} else {
print("Error accessing WhatsApp")
}
}
}
}