getInitialURL Not Returning Full URL


#1

Hi everyone, I currently have a standalone app running Expo 18 on an iPhone and I’m using testflight. I’m currently testing by clicking on the links below. I’m using Linking.getInitialURL and it isn’t returning anything except for the app name “ayup://” when I click on the links. I’m showing the url in an Alert.alert(). Is there something I’m doing wrong? I’ve tried the following URLs and they don’t work:

ayup://url/me?param1=kdfjdkfjk&param2=398394
ayup://+url/me?param1=kdfjdkfjk&param2=398394
ayup://url/me?param1=kdfjdkfjk&param2=398394+
ayup://?param1=kdfjdkfjk&param2=398394+

Thanks,
Matt


#2

Hi, are you sure you’ve distinguished these two cases?

https://docs.expo.io/versions/v18.0.0/guides/linking.html#1-if-the-app-is-already-open-the-app-is-foregrounded-and-a-linking-event-is-fired

It sounds like you should be listening for events (case #1) and using the url that comes back with those events. The initial url will never change after the app is open, and if the app was launched without a specific link, then that’s just a URL to the root of your app (e.g. ayup://).


#3

Hey Ben, each time I closed out the application, waited a few seconds and then clicked on another link. I’ve read through that documentation and understand that if the app is already open I should be subscribing to the addEventListener call.

Edit:
The event listener call actually works but the getInitialURL does not


#4

I realize this is an old thread, but it’s been very difficult finding others with this exact same problem. I’ve been able to repro this in a very minimal project: https://github.com/expo/expo/issues/1673