Closed tsunhousam91 closed 2 months ago
Well browsing this code is not a lot of fun... Still, it should work by adding checks to the right places.
I may suggest to check if the initial link is coming from UIScene.ConnectionOptions.urlContexts
or UIScene.ConnectionOptions.userActivities
in scene::willConnectTo
...
@llfbandit thanks After test, I found when app is closed the link will be passed to scene::willConnectTo
So I try this:
` func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { guard let windowScene = scene as? UIWindowScene else { return }
// other code...... if let userActivity = connectionOptions.userActivities.first { self.scene(scene, continue: userActivity) } } `
and it finally worked. thank you
Thanks for the feeback!
Describe the bug
My flutter app support carplay, So I changed the AppDelegate and SceneDelegate like #81 and I can not get the link when first time I open the app by clicking link.
--- My AppDelegate --- @implementation AppDelegate
(BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions {
[AppLinksHelper.shared handleLaunchOptions:launchOptions];
[super application:application didFinishLaunchingWithOptions:launchOptions]; return true; // [GeneratedPluginRegistrant registerWithRegistry:self]; // [FlutterDownloaderPlugin setPluginRegistrantCallback:registerPlugins]; // return [super application:application didFinishLaunchingWithOptions:launchOptions]; }
--- AppLinkHelper --- import Foundation import app_links
@objc public class AppLinksHelper: NSObject { @objc public static let shared = AppLinksHelper()
}
--- SceneDelegate --- import UIKit import Flutter import SwiftEventBus import app_links import FirebaseCore import UserNotifications //import FirebaseMessaging @available(iOS 13.0, *) class SceneDelegate: UIResponder, UIWindowSceneDelegate, UNUserNotificationCenterDelegate{ var window: UIWindow?
}