ios - 如何使用 URL Scheme 修复 iOS 13 中的 'sharing to instagram stories'

标签 ios swift instagram-api url-scheme uipasteboard

我已经实现了分享到 insta 故事,这些故事在 iOS 12 上运行良好,但在 iOS 13 上运行不佳。

我已经尝试/验证了以下几点

  • 经过验证的 URL 方案
  • 检查对 UIPasteBoard 的更改
  • 经过验证的 Assets 网址

一切都按照文档: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 而不是 URL Schemes 中添加了 instagram-stories

关于ios - 如何使用 URL Scheme 修复 iOS 13 中的 'sharing to instagram stories',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58336717/

相关文章:

ios - 使用 UIViewPropertyAnimator 通过触摸中断动画

facebook - 如何过渡到 Instagram Graph API for/users/self/media

http - 在没有浏览器的情况下从 Instagram API 获取访问 token ?

iphone - IOS 通用应用轮换

ios - MapKit 的点击手势

ios - 不能将 Realm 与对象映射器 swift 3.0 一起使用

swift - 返回 View Controller Swift 4 时 AVFoundation 摄像机崩溃

instagram - 使用 Instagram API 从我的帐户读取统计信息?

objective-c - 通过 iOS Objective-C 2.0 解析 Google Search API XML 结果

ios - CLFloor 返回水平 2146959360?