我正在尝试从我的应用程序轻松共享到Instagram。我想要的是进入下面屏幕截图所示的屏幕。我试过Instagram故事://分享深度链接,我已经阅读了所有这些文档:https://developers.facebook.com/docs/instagram/sharing-to-stories/
然而,无论我做什么,当url scheme动作触发时,它直接将图像分享到故事中。我在这里错过了什么?
这是我的代码摘录:
if let image = image {
guard let urlScheme = URL(string: "instagram-stories://share"),
let imageData = image.pngData() else {
return
}
if UIApplication.shared.canOpenURL(urlScheme) {
let pasterboardItems = [["com.instagram.sharedSticker.backgroundImage": imageData]]
let pasterboardOptions = [UIPasteboard.OptionsKey.expirationDate: Date().addingTimeInterval(60*5)]
UIPasteboard.general.setItems(pasterboardItems, options: pasterboardOptions)
UIApplication.shared.open(urlScheme, options: [:], completionHandler: nil)
}
}
image
是“png”LSApplicationQueriesSchemes
)中允许“instagram-stories”