iosswiftinstagram-apiurl-schemeuipasteboard

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

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")
            }

Solution

  • 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.