Newer iOS versions deliver shared URLs through UISceneDelegate rather than AppDelegate. To ensure the plugin continues to work, your app must adopt a SceneDelegate that subclasses FlutterSceneDelegate.
If your app uses other URL-handling libraries (like flutter_branch_sdk or uni_links), you must manually pass the lifecycle events to ReceiveSharingIntentPlugin to prevent them from being intercepted by other handlers.
import Flutter
import UIKit
import receive_sharing_intent
class SceneDelegate: FlutterSceneDelegate {
// Called on a cold start
override func scene(
_ scene: UIScene,
willConnectTo session: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions
) {
// Pass events to the plugin to prevent other libraries from absorbing links
_ = ReceiveSharingIntentPlugin.instance.scene(scene, willConnectTo: session, options: connectionOptions)
super.scene(scene, willConnectTo: session, options: connectionOptions)
}
// Called while the app is already running (warm start)
override func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
if ReceiveSharingIntentPlugin.instance.scene(scene, openURLContexts: URLContexts) {
return
}
super.scene(scene, openURLContexts: URLContexts)
}
}