【发布时间】:2020-11-25 11:33:43
【问题描述】:
iOS 14.2,我无法按照https://developers.facebook.com/docs/instagram/sharing-to-feed/ 中的说明分享图片
我可以通过这个菜单正确地将相同的图像分享给任何其他应用程序(例如电报)
代码:
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)
}
}
【问题讨论】:
-
我也遇到了同样的问题,你找到解决办法了吗?
-
这里有同样的问题。非常令人沮丧。除 Instagram 外,其他所有选项都适用
标签: ios swift facebook instagram