iOS 14.2, I am not able to share image as described in https://developers.facebook.com/docs/instagram/sharing-to-feed/
I can share same image to any other app from this menu correctly (e.g. telegram)
Code:
func shareToInstagramFeed() {
let instagramURL = NSURL(string: "instagram://")
if UIApplication.shared.canOpenURL(instagramURL! as URL) {
let jpgPath = (NSTemporaryDirectory() as NSString).appendingPathComponent("instagram.ig")
do {
try selectedImage.image?.jpegData(compressionQuality: 1)?.write(to: URL(fileURLWithPath: jpgPath), options: .atomic)
} catch {
print(error)
}
let rect = CGRect.zero
documentInteractionController = UIDocumentInteractionController(url: URL(fileURLWithPath: jpgPath))
documentInteractionController.delegate = self
documentInteractionController.uti = "com.instagram.photo"
documentInteractionController.presentOpenInMenu(from: rect, in: view, animated: true)
}
}
2
Answers
I was struggling with this and ended up using the UIActivityViewController and it worked.
With Instagram version of 171.0 this issue is fixed. It’s working but it’s very ugly, you can’t choose story or feed, and you can’t edit photo.
I believe that in the feature instagram will make this feature better.
If you need to share just one image you can use this workaround:
(imageUrl intentionally typed 2 times)
Then you will get following screen: