Ich habe in meiner App-Taste, um Bild über WhatsApp zu teilen und es funktioniert. Aber es gibt einige seltsame Dinge, die auf einigen Geräten im Menü von UIDocumentInteractionController angezeigt werden. Dieser ist der Code:Bild über WhatsApp teilen
let urlWhats = "whatsapp://app"
if let urlString = urlWhats.addingPercentEncoding(withAllowedCharacters:CharacterSet.urlQueryAllowed) {
if let whatsappURL = URL(string: urlString) {
if UIApplication.shared.canOpenURL(whatsappURL as URL) {
if let imageData = UIImageJPEGRepresentation(self.ivFramedPicture.image!, 1.0) {
let tempFile = URL(fileURLWithPath: NSHomeDirectory()).appendingPathComponent("/Documents/whatsAppTmp.wai")
do {
try imageData.write(to: tempFile, options: .atomic)
self.documentInteractionController = UIDocumentInteractionController(url: tempFile)
self.documentInteractionController.delegate = self
self.documentInteractionController.uti = "net.whatsapp.image"
self.documentInteractionController.presentOpenInMenu(from: CGRect.zero, in: self.view, animated: true)
} catch {
print(error)
}
}
} else {
// Cannot open whatsapp
}
}
}
Wenn ich auf dem 1 whatsapp Symbol klicken, um es einige Datei sendet, die nicht auf iPhones öffnet (Android öffnet die Datei wie Bild)
Kann jemand helfen, dieses Problem zu lösen? Ich möchte nur ein Symbol mit Bild teilen, das ist es. Dank