ShoutSocial / share_handler

A plugin to facilitate receiving and handling share intents
41 stars 39 forks source link

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

Open afl-dev opened 11 months ago

afl-dev commented 11 months ago

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 commented 10 months ago

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

AlinaJang commented 8 months ago

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.