KasemJaffer / receive_sharing_intent

A Flutter plugin that enables flutter apps to receive sharing photos, text and url from other apps.
Apache License 2.0
325 stars 375 forks source link

Custom group Ids do not work on iOS. Code in repository to fix this remains unpublished. #213

Open mjbader opened 2 years ago

mjbader commented 2 years ago

Hello, I have been working with this app and have run into issues with using custom group app ids is iOS. In short the issue is because code in the repo has been updated without updating the version number in the pubspec.yaml so it remains unpublished. When attempting to download through the pubspec.yaml only group.com.$(PRODUCT_BUNDLE_ID) will work.

Here's how I added the plugin in my pubspec.yaml for reference: receive_sharing_intent: ^1.4.5

And the code that is problematic is in SwiftReceiveSharingIntentPlugin.swift for the published version:

private func handleUrl(url: URL?, setInitialData: Bool) -> Bool {
        if let url = url {
            let appDomain = Bundle.main.bundleIdentifier!
            let userDefaults = UserDefaults(suiteName: "group.\(appDomain)")
            if url.fragment == "media" {
                if let key = url.host?.components(separatedBy: "=").last,
                    let json = userDefaults?.object(forKey: key) as? Data {
                    let sharedArray = decode(data: json)
                    let sharedMediaFiles: [SharedMediaFile] = sharedArray.compactMap {
                        guard let path = getAbsolutePath(for: $0.path) else {

Notice how it pulls the bundleIdentifier rather than the custom app group specified in the documentation. As a workaround I can directly pull what's in the repository, but I would like to be able to manage the version we are using on our side to avoid breakage. I would not be surprised if this was causing the breakage for a variety of the iOS issues filled here.

Can you guys please push out a new version to address this issue?