Please provide the following:
- SDK Version: 43.0.1
- Platforms(Android/iOS/web/all): iOS
- Add the appropriate “Tag” based on what Expo library you have a question on.
I’ve been struggling for days trying to figure out why the Linking eventListener doesn’t seem to work. Iam setting up the event listener correctly:
Linking.addEventListener(“url”, handleStravaRedirect);
where “handleStravaRedirect” is the callback function to be called after the user grants my app permission on the 3rd party website. The problem is, this function never gets called after the redirect back to my app. I thought I was doing something wrong, but when I tried the auth flow on android, the event handler triggered as expected.
Are there any extra steps I need to do to make Linking work on iOS?
Other information:
I’m importing Linking like so:
-
import * as Linking from “expo-linking”; (It would be nice if there was a default export for this; kind of confusing)
-
To make the Auth Request and open the web browser, I’m using: AuthSession.useAuthRequest
-
When I log “Linking.addEventListener” right above where it gets linked, the function is there and I receive no errors that adding the event listener failed, So I’m assuming that part is set up properly and the problem is purely on reopening of my app from the browser.
-
I’m having the same issue in Dev when I’m using the "exp:// " scheme and in Testflight when I use my custom “herofit://” scheme.
Please help, I’m stumped!
EDIT: One other thing I noticed:
It seems like iOS handles the app being pushed to the background & the redirect differently than android handles it, almost like the Linking eventListener doesn’t even know the user left the app in the first place.
Edit2: My issue seems to be the same as the one over here: Expo deeplinking issue with addEventListener - #14 by chiu1028