最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Flutter app_links not detecting deep links when MobileMessaging is installed on iOS - Stack Overflow

programmeradmin3浏览0评论

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.

  1. How can I make app_links work alongside MobileMessaging?
  2. Is there a way to ensure MobileMessaging does not block deep links?
  3. Should app_links be initialized differently to avoid conflicts?
  4. Has anyone encountered this issue, and what workarounds exist?

发布评论

评论列表(0)

  1. 暂无评论