Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

URL scheme-based deep links broken on iOS 14?

Discussion in 'iOS and tvOS' started by jmassey-tkg, Jun 11, 2021.

  1. jmassey-tkg

    jmassey-tkg

    Joined:
    Mar 11, 2020
    Posts:
    7
    I'm trying to get scheme-based deep linking working for my app. I've gotten to the point where links with our app's url scheme can open our app, but the Application.deepLinkActivated event doesn't fire and Application.absoluteURL is always null. I've followed the processes outlined in the guides:
    1. iOS settings -> Configuration -> Supported URL schemes
    2. Add 'exampleapp' as a url scheme
    3. Create a script which registers for Application.deepLinkActivated
    Our app is built in unity cloud build using editor 2020.3.8f1.

    After installing the built app, the exampleapp:// url scheme is able to open our app. Typing a url such as "exampleapp://deeplink" into notes causes it to become a clickable link. I open our unity app, switch to notes, and then click the link to our app. After clicking on the link, the phone switches to back our app but Application.deepLinkActivated doesn't seem to fire because the script I have linked to that event doesn't run (it shows text on an orange background). Is this perhaps a thing with the new iOS14 rules and I just need to use universal links instead? Would appreciate any help or thoughts from someone who's seen this or gone through this before.

    Here's the script for reference:

    Code (CSharp):
    1. public class DeeplinkTester : MonoBehaviour {
    2.  
    3.     [SerializeField] TextMeshProUGUI _messageText;
    4.     [SerializeField] GameObject _messageRootObj;
    5.  
    6.     void Start() {
    7.         Application.deepLinkActivated += OnDeepLink;
    8.         OnDeepLink("test uri");
    9.     }
    10.  
    11.     void OnDeepLink(string uriString) {
    12.         _messageRootObj.SetActive(true);
    13.         _messageText.text = uriString;
    14.  
    15.         StopAllCoroutines();
    16.         StartCoroutine(CorHideMessage(3));
    17.     }
    18.  
    19.     System.Collections.IEnumerator CorHideMessage(float delay) {
    20.         yield return new WaitForSeconds(delay);
    21.         _messageRootObj.SetActive(false);
    22.     }
    23.  
    24. }
    Cheers,
    Jordan
     
  2. jmassey-tkg

    jmassey-tkg

    Joined:
    Mar 11, 2020
    Posts:
    7
    Qbit86 and hantengx like this.