1

I'm using Firebase Dynamic Links for Unity, and I've got it working well with Android. I've even got a solution for Desktop, where the fallback link takes users to a webpage where I can provide instructions to the user for how to get their link content on Desktop.

On iOS, however, I always get errors like this when trying dynamic links:

[Firebase/Analytics][I-ACS023001] Deep Link does not contain valid required params. URL params: {
    "_cpb" = 1;
    "_cpt" = cpit;
    "_fpb" = "CIAIEIAGGgVlbi11cw==";
    "_iipp" = 1;
    "_iumchkactval" = 1;
    "_iumenbl" = 1;
    "_osl" = "https://cgs.link/zu_tiles_hime?_iipp=1";
    "_plt" = 260;
    "_uit" = 1064;
    apn = "com.finoldigital.cardgamesim";
    cid = 8062347334713659136;
    ibi = "com.finoldigital.CardGameSim";
    isi = 1392877362;
    link = "https://www.cardgamesimulator.com/link%%3Furl%%3Dhttps://www.cardgamesimulator.com/games/zu_tiles_hime/zu_tiles_hime.json";
    sd = "Play Zu Tile: Hime on CGS!";
    si = "https://www.cardgamesimulator.com/games/zu_tiles_hime/Banner.png";
    st = "Card Game Simulator - Zu Tiles: Hime";
}

I saw in another issue that it could be because of ?, =, and & symbols in the link, so I url-encoded those, but I am still getting the same error.

For reference, my code for iOS is effectively:

private void Start()
{
            FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task =>
            {
                var dependencyStatus = task.Result;
                if (dependencyStatus != DependencyStatus.Available)
                {
                    Debug.LogError("Could not resolve all Firebase dependencies: " + dependencyStatus);
                    return;
                }
                DynamicLinks.DynamicLinkReceived += OnDynamicLinkReceived;
            });
}

I immediately log in OnDynamicLinkReceived, so this callback is clearly never happening. Does anybody know what I am doing wrong, or what I could do to get the dynamic link received callback?

1 Answers1

1

For anyone who runs into the same issue: I solved this by modifying my build script to add the values for FirebaseDynamicLinksCustomDomains and FirebaseAppDelegateProxyEnabled to Info.plist as part of my build process.

PostProcess code:

var pbxProjectPath = PBXProject.GetPBXProjectPath(buildPath); 
var pbxProject = new PBXProject(); pbxProject.ReadFromFile(pbxProjectPath); 
const string targetName = "Unity-iPhone"; var targetGuid = pbxProject.GetUnityMainTargetGuid();
 var src = AssetDatabase.GetAssetPath(file); 
var fileName = Path.GetFileName(src); 
var dst = buildPath + "/" + targetName + "/" + fileName; 
if (!File.Exists(dst)) FileUtil.CopyFileOrDirectory(src, dst); pbxProject.AddFile(targetName + "/" + fileName, fileName); 
pbxProject.AddBuildProperty(targetGuid, "CODE_SIGN_ENTITLEMENTS", targetName + "/" + fileName);
 pbxProject.WriteToFile(pbxProjectPath);
 var plistPath = buildPath + "/Info.plist";
 var plistDocument = new PlistDocument(); plistDocument.ReadFromString(File.ReadAllText(plistPath)); 
var rootDict = plistDocument.root; 
rootDict.SetBoolean("FirebaseAppDelegateProxyEnabled", false);
 PlistElementArray customDomains = rootDict.CreateArray("FirebaseDynamicLinksCustomDomains");
 customDomains.AddString("https://cgs.link"); 
File.WriteAllText(plistPath);