1

I integrated a feature in my Flutter app using iOS Custom URL Schemes, where I allow users to share content to Instagram Stories. I did this by following Meta's guide

This is the Swift code that my Flutter app calls:

private func shareStickerImage(appID: String, stickerImage: Data, backgroundTopColor: String, backgroundBottomColor: String) {
        do{
            guard let urlScheme = URL(string: "instagram-stories://share?source_application=\(appID)") else {
                return //"Creating url scheme failed"
            }

            if UIApplication.shared.canOpenURL(urlScheme) {
                let pasteboardItems: [[String: Any]] = try [
                    [
                        "com.instagram.sharedSticker.stickerImage": stickerImage,
                        "com.instagram.sharedSticker.backgroundTopColor": backgroundTopColor,
                        "com.instagram.sharedSticker.backgroundBottomColor": backgroundBottomColor
                    ]
                ]

                let pasteboardOptions: [UIPasteboard.OptionsKey: Any] = try [
                    .expirationDate: Date().addingTimeInterval(60 * 5)
                ]

                try UIPasteboard.general.setItems(pasteboardItems, options: pasteboardOptions)
               try  UIApplication.shared.open(urlScheme, options: [:], completionHandler: nil)
            } else {
                return
                // Handle error cases
            }
        }catch{
            print("error")
        }
       
        return
        
    }

It works fine, but I'm looking to see if I can add an attribution link to the Instagram Story, so a user on Instagram can click it to open the content within my app. When you share a story from,for example SoundCloud, it allows you to click an attribution link. The guide on Meta doesn't show how to do this. Does anyone know how to go about adding an attribution link to the sharing intent?

1

0

Browse other questions tagged or ask your own question.