Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS not work event handler ShareHandler.instance.sharedMediaStream #69

Open
afl-dev opened this issue Sep 27, 2023 · 2 comments
Open

iOS not work event handler ShareHandler.instance.sharedMediaStream #69

afl-dev opened this issue Sep 27, 2023 · 2 comments

Comments

@afl-dev
Copy link

afl-dev commented Sep 27, 2023

iOS not work event handler ShareHandler.instance.sharedMediaStream, when the application is running and we try to send a file, it is not called event handler,
on startup everything is fine (ShareHandler.instance.getInitialSharedMedia())

share_handler: ^0.0.18

@tmratwork
Copy link

same for me, in iOS when running app event handler not called. share_handler: ^0.0.19

@AlinaJang
Copy link

AlinaJang commented Dec 28, 2023

import share_handler_ios

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {

     let sharingIntent = SwiftShareHandlerIosPlatform.instance
     /// if the url is made from SwiftFlutterSharingIntentPlugin then handle it with plugin [SwiftFlutterSharingIntentPlugin]
     if sharingIntent.hasMatchingSchemePrefix(url: url) {
         return sharingIntent.application(app, open: url, options: options)
     }

     // Proceed url handling for other Flutter libraries like uni_links
     return super.application(app, open: url, options:options)
   }

}

Try adding above override function in AppDelegate. Its helps me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants