简体   繁体   中英

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

I have implemented sharing to insta stories which are working fine for iOS 12 but not working on iOS 13.

I have tried/verified following points

  • Verified URL Scheme
  • Checked changes to UIPasteBoard
  • Verified asset urls

Everything is as per documentation: 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")
            }

I resolved my issue and i was messing in info.plist.

make sure that you have added instagram-stories in LSApplicationQueriesSchemes not in URL Schemes .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM