Issues with URL Query Passing in Branch.io Deep Linking on iOS with Unity

47 views Asked by At

I'm currently integrating Branch.io's deep linking into my Unity project for both Android and iOS platforms. While everything works as expected on Android, I'm encountering issues on iOS when trying to pass URL queries via deep links.

Environment:

Implementation Details: On Android, passing URL queries through links like https://hyb0e.test-app.link/8QpNXN154Gb?url=challenges/a90fcf58-f92f-4d92-9dfc-ad8c4090ddee?game=22311583-4bed-4613-a4ce-87e226a3c9c5&subdomain=test-omgeving works perfectly. However, I'm struggling to achieve the same on iOS. Below is the relevant portion of my code:

public void Start() 
{
    Branch.enableLogging();
    Branch.setTrackingDisabled(false);
    Branch.initSession(CallbackWithBranchUniversalObject);
}

private void CallbackWithBranchUniversalObject(BranchUniversalObject universalObject, BranchLinkProperties linkProperties, string error) 
{
    if (!string.IsNullOrEmpty(error)) 
    {
        Debug.Log("Branch error: " + error);
        return;
    } 

    if (universalObject == null || universalObject.metadata.GetCustomMetadata() == null)
    {
        Debug.Log("Branch error: universalObject or metadata is null");
        return;
    }

    var md = universalObject.metadata.GetCustomMetadata();
    if (!md.ContainsKey(DeepLinkManager.QueryUrlParameter) || 
        !md.ContainsKey(DeepLinkManager.QuerySubdomainParameter))
    {
        Debug.Log("Branch error: metadata does not contain url or subdomain:");
                
        return;
    }

    var urlPath = md[DeepLinkManager.QueryUrlParameter];
    var subdomain = md[DeepLinkManager.QuerySubdomainParameter];

    deepLinkManager.SetDeepLink(urlPath, subdomain);
}

Issue: The deep link seems not to pass the URL query parameters correctly on iOS. The metadata is missing the expected keys for URL and subdomain, which leads to the log: "Branch error: metadata does not contain url or subdomain:".

Has anyone faced a similar issue with Branch.io deep linking in Unity for iOS, specifically with passing URL query parameters? Any insights or solutions on how to ensure the URL query parameters are correctly passed and retrieved in the iOS environment would be greatly appreciated.

0

There are 0 answers