如何使用 URL 方案修复 iOS 13 中的 'sharing to instagram stories'

How to fix 'sharing to instagram stories' in iOS 13 using URL Scheme

我已经实现了分享到 insta 故事,这些故事适用于 iOS 12,但不适用于 iOS 13。

我有tried/verified以下要点

一切都按照文档:https://developers.facebook.com/docs/instagram/sharing-to-stories/

if schemeAvailable(scheme: "instagram-stories://share"){
                let pasteboardItems = ["com.instagram.sharedSticker.backgroundImage":UIImagePNGRepresentation(postImage!)!,
                                       "com.instagram.sharedSticker.contentURL":"http://google.com"] as [String : Any]
                UIPasteboard.general.setItems([pasteboardItems])
                UIApplication.shared.open(URL(string: "instagram-stories://share")!, options: [:], completionHandler: { (finished) in
                    print("")
                })
            }else{
                print("Can't open URL")
            }

我解决了我的问题,但我搞砸了 info.plist。

确保您在 LSApplicationQueriesSchemes 中添加了 instagram-stories 而不是 URL Schemes