0

I have flutter app and deeplinks works fine when I click on button from gmail for Android app but not for iOS.

enter image description here

the URL in the email templates comes from courier, courier generates the cta URLs itself and then it is added to a button in a template via <a href https://718d95b0-XXXX-test.ct0.app> Here is what I have so far:

apple-app-site-association

   {
      "applinks": {
        "apps": [],
        "details": [
          {
            "appID": "TeamId.BundleId",
            "paths": ["*", "/"]
          }
        ]
      }
    }

Info.plist

    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>DomainName</string>
            </array>
        </dict>
    </array>
    <key>FlutterDeepLinkingEnabled</key>
    <true/>

in iOS AppDelegate.swift

import UIKit
import Flutter
import courier_flutter

@UIApplicationMain
@objc class AppDelegate: CourierFlutterDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }


    override func application(
      _ application: UIApplication,
      open url: URL,
      options: [UIApplication.OpenURLOptionsKey : Any] = [:]
    ) -> Bool {
      // Handle the incoming URL and pass it to the Flutter engine
      if let controller = window?.rootViewController as? FlutterViewController {
        let channel = FlutterMethodChannel(name: "BundleId/deeplink", binaryMessenger: controller.binaryMessenger)
        channel.invokeMethod("onDeepLinkReceived", arguments: url.absoluteString)
      }
      return true
    }
}

in flutter routes.dart

     GoRoute(
        name: NamedRoute.home,
        path: '/',
        redirect: (context, state) => state.locationWithQuery(
          '/dashboard',
        ),
      ),

Runner.entitlements

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>aps-environment</key>
    <string>development</string>
    <key>com.apple.developer.associated-domains</key>
    <array>
        <string>applinks:domain</string>
    </array>
    <key>com.apple.security.network.client</key>
    <true/>
</dict>
</plist>
4
  • have you added domain in associated domains? reference: docs.flutter.dev/cookbook/navigation/… Commented Jun 25 at 13:06
  • yes, all set, I will add the code to the question
    – Sarah Sami
    Commented Jun 25 at 14:00
  • Apple’s content delivery network requests the apple-app-site-association file for your domain within 24 hours.
    – cristallo
    Commented Jun 25 at 16:17
  • the issue is not in Apple, the URL generated by courier for CTA is different than the one I added as a domain in Info.plist
    – Sarah Sami
    Commented Jun 25 at 16:51

0