I am using the app_links package to handle deep links in my Flutter app, and it works perfectly on iOS. However, when I integrate the MobileMessaging SDK and call MobileMessagingPluginApplicationDelegate.install() in AppDelegate.swift, deep links stop being detected.
Here is my delegate file
import Flutter
import UIKit
import app_links
import MobileMessaging
import FBSDKCoreKit
@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
// Handle deep links
if let url = AppLinks.shared.getLink(launchOptions: launchOptions) {
AppLinks.shared.handleLink(url: url)
//also try return true here
}
// Initialize Mobile Messaging
MobileMessagingPluginApplicationDelegate.install()
// Initialize Facebook SDK
ApplicationDelegate.shared.application(
application,
didFinishLaunchingWithOptions: launchOptions
)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
override func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]
) -> Bool {
// Handle Facebook deep links
return ApplicationDelegate.shared.application(
app,
open: url,
options: options
)
}
}
I set the FlutterDeepLinkingEnabled to false in plist file.
In the main widget i set the stream and listen for links as flow
_linkSubscription = AppLinks().uriLinkStream.listen((uri) {
print('onAppLink: $uri');
print("Path ${uri.toString()}");
if (webViewController != null) {
webViewController!.loadUrl(urlRequest: URLRequest(url: WebUri(widget.initialUrl + uri.path)));
}
});
Cannot catch the links with this implementation.
- How can I make app_links work alongside MobileMessaging?
- Is there a way to ensure MobileMessaging does not block deep links?
- Should app_links be initialized differently to avoid conflicts?
- Has anyone encountered this issue, and what workarounds exist?