Universal links (Deep linking) not working on iPhone but works on iPad
Asked Answered
C

4

17

I am trying to build deep linking feature into my app. I did all the necessary set up for deep linking to work like, enabling associated domains in my app, adding apple-app-site-association to the root directory of my server, and I am serving a valid apple-app-site-association over https, I also validated my apple-app-site-association using this tool Validate your apple-app-site-association.

After doing everything right, I tested the deep linking feature on my iPad and it worked as expected. But when I tried to do the same on my iPhone it doesn't work, it always took me to safari. I tried it on 6s device, I reinstalled the app, I cleared Safari website data & cleared the history. Also updated the iPhone & iPad to iOS 9.3.5. The updating the OS didn't change a thing.

iPad still continue to work with deeplink URLs just like it did while it was on 9.3.4. iPhone still opened the link in safari.

Please give me some pointers on how to workaround this issue, I think this might be an apple bug but again I don't understand how it can work on iPad which is running same software as iPhone. Any help or guidelines is much appreciated.

Thanks.

Christadelphian answered 27/8, 2016 at 13:34 Comment(0)
C
27

I was able to fix this issue and this is one of the annoying issue that I have come across, because it doesn't say what is going wrong.

Fix: Whenever the iOS opens your link in safari, you need to pull down the webpage in safari and there you'll see a banner saying that, open it in the app. Once you click on that banner your future links will start opening the app instead of opening it in the safari browser.

There was no error whatsoever and there was no indication why the link was getting opened I am pretty sure that, iOS didn't download the apple-app-site-association whenever I installed the app.

Also note that the banner in the webpage will not be visible whenever your link opens up in safari, you need to pull down the webpage and then the banner will become visible and if you click on open in app banner, it will start opening the links in app.

If in future if you select to view the link in safari by clicking on context menu which appears on right hand side of the status bar, which will be saying "Open in [your app name]" in safari, the links in future will open in safari instead of app, and again if the banner open in app isn't visible, you have to pull down the webpage to see that banner.

HTH.

Christadelphian answered 27/8, 2016 at 14:4 Comment(9)
You're very close: what probably happened here is that when you initially were testing, you inadvertently hit the little 'forward to web' button in the top right corner of the screen. This permanently disables Universal Links for that domain on your device, and it is very easy to do. The preference is saved even when deleting the app and reinstalling, so it's extremely frustrating to debug. Pulling down to get the banner as you suggested is one way to re-enable Universal Links. Another is to paste the link into Notes (or some other app) and long-press until 'Open in [app name]' appears.Bimetallism
I didn't know this - Another is to paste the link into Notes (or some other app) and long-press until 'Open in [app name]' appears. Thank you :)Christadelphian
@Christadelphian is there any solution that it can without pulling down the web page it should directly take to the app.Alternant
@TeenanathPaul Hey by default it should take you to the app. But sometimes it'll take you to the Safari browser and then you need to go the app by clicking on the banner, open in app. So if you don't see the banner you have to pull down the webpage that's the only way I believe. Apart from this what you can also do is you can deploy a page for that deep link url at your server and then in that webpage you can show your custom banner in the webpage. One example is look at how Quora app has implemented the deep linking. HTH.Christadelphian
@Christadelphian can you also paste the JS part to pull down the web page? we also have the similar problem ...Extinguish
@SampathKumar You need not need any JS code to get pull down the web page. Whenever the page opens in the Safari just pull it down, it automatically shows the open in app pop up if app is installed.Christadelphian
As of 10/3, ios 13 universal links are broken (13.1.2). When I pull down the banner says “View” for the Apple Store app! (Not the AppStore app). This is also happening in different ways to popular apps like instagram and even apples appsDeanery
In my case, link will open on some devices and shows 404 error on some devices. Why this happen dont know but link is valid still shows 404 on some devices.Felipa
How to redirect to app on clicking link(anchor tag on a web page with href as universal link)? This is working on chrome but not safari for me. But this is working for amazon on safari though.Proceeds
Z
10

In iOS 13, similar problem of direct links not opening the app instead it open the safari website directly.

Fixed by updated the below safari setting... Settings > Safari > Request Desktop Website > All websites > Switch Off

Zaratite answered 21/10, 2019 at 11:33 Comment(2)
Had the same problem with iOS 13 and this problem solved, thank you for sharing!Erminia
Same experience hereTerbium
L
2

I was facing the same issue in iOS 12, on one device the link redirected to my app and on another device it was always redirecting to Safari and pressing the link on the Notes app was only allowing me to open it on Safari.

What I believe happened was that I pasted the URL in the browser and clicked Go, as I thought it would redirect to my app. No matter what I did ( reinstalling the app, restarting the device, ... ) the results were always the same, redirecting to Safari. What helped me was deleting the cached data for my domain ( Settings -> Safari -> Advanced -> Website Data -> Swipe and delete the data for your domain ).

After that, everything started working.

Lustreware answered 2/9, 2019 at 15:31 Comment(0)
R
1

I believe this is a bug with iOS Simulator,
In my case it was occurred when I entered an invalid address (with multiple spaces) for example:

Valid One: myApp://order/10003101
Invalid One: myApp://order/1003131

It stopped working even with Valid One and the solution was to clear Safari Website Data:

Go to Settings/Safari -> Clear History and Webstie Data

  • Device: iPhone 12 Pro Max
  • iOS: 14.5
  • Xcode: 12.5
Ruder answered 12/9, 2021 at 10:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.