HomeiOS Developmentswift - Share to Instagram tales for ios

swift – Share to Instagram tales for ios


I am making an attempt to implement sharing to instagram tales and have the message open the app underneath the title of instagram consumer.

I attempted loads of issues

From facebooks docs

  1. Created a Meta account and added all obligatory ids in plist recordsdata
  2. I added a platform in my Meta app for iOS
  3. I put the app in stay state and added instagram setup

From my app in xcode

func shareToInstagramStory(_ imageData: Information?) {
    guard let imageData else {
        return
    }
    let fbAppId = "id"
    if let urlScheme = URL(string: "instagram-stories://share?source_application=(fbAppId)"),
       UIApplication.shared.canOpenURL(urlScheme) {

        let pasteboardItems: [[String: Any]] = [
            [
                "com.instagram.sharedSticker.stickerImage": imageData,
                "com.instagram.sharedSticker.contentURL": "app://welcome",
                // Tried these also
                // "com.instagram.contentURL": "app://welcome"
                // "com.instagram.sharedSticker.inputURL": "app://welcome"
                // "com.instagram.sharedSticker.inputScheme": "app"

            ]
        ]

        let expirationDate = Date().addingTimeInterval(300)
        let pasteboardOptions = [
            UIPasteboard.OptionsKey.expirationDate: expirationDate
        ]

        UIPasteboard.basic.setItems(pasteboardItems, choices: pasteboardOptions)

        UIApplication.shared.open(urlScheme, choices: [:], completionHandler: nil)
    } else {
        print("Instagram is just not put in or URL scheme is unavailable.")
    }
}

So it appears that evidently I am lacking one thing as a result of I see loads of apps doing this however I can not see to seek out something within the docs.
Any concepts

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments