Sie müssen dies tun:
- Speichern Ihr Foto Foto-Bibliothek
- Nehmen Asset-URL von gespeicherten Fotos
- öffnen Instagram durch URL-Schema mit dieser URL
instagram : // library? AssetPath = ASSET_PATH
Dabei ist ASSET_PATH die Asset-URL, die im zweiten Schritt übernommen wird.
Codebeispiel auf Swift 3:
let library = ALAssetsLibrary()
library.writeImage(toSavedPhotosAlbum: image.cgImage, metadata: nil) { (url, error) in
if let url = url {
DispatchQueue.main.async {
let path = url.absoluteString.addingPercentEncoding(withAllowedCharacters: NSCharacterSet.urlQueryAllowed)
let instagram = URL(string: "instagram://library?AssetPath=\(path)")
UIApplication.shared.open(instagram!)
}
}
}
Mit dem Menü meinst du UIActivityController? –
Ich meine UIDocumentInteractionController. –
Einige, wie ich nicht in der Lage, auf dieses Instagram-Dokument hier zugreifen, die Informationen https://www.instagram.com/developer/mobile-sharing/iphone-hooks/# hat. Sie können nach "iPhone Instagram Hooks" für mehr suchen. –