Universal links (Deep linking) not working on iPhone but works on iPad - ios

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.

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.

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

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.

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

Related

Universal links not working in iOS 12.2 , 12.3

I recently implemented universal links in iOS. It works fine in iOS version 12.1 and below but fails to redirect back to the app in iOS 12.2 and 12.3.
Issue in 12.2 and higher:
The browser doesn’t redirects back to the app but I do get a banner(with an ‘OPEN’ button) in the browser to open the content in the app.
Even when I copy the link in Notes and long press it, it shows me the option to open the link in my app.
I read in some article that there is a possibility that universal links get disabled and by choosing the option to ‘Open in {myApp}’ re-enables it. But this is not the case.
Despite trying the above method, universal links still doesn’t works the way it should.
Pre-Checks:
AASA link is verified through Branch.io validator
Applink is registered in entitlements.plist file
Proper handling of redirected url is performed (Note that I do get a banner in the browser to open the url in my app and upon clicking
on it, the app functions as it needs to)
Is there any change from 12.2 that I am missing?
I went through the release notes and was unable to find anything about universal links.
Any help is appreciated.

Dynamic link does not open the app, and "open in app" option not available in context menu

I just encountered a very weird behaviour with Firebase dynamic links.
It works perfectly on all of our test devices except for one.
This specific device is an iPhone-x, and the account was restored via iTunes (Not sure if this info is relevant, but i'm trying to give a full picture).
Our app is installed on this device from the app store (also tried deleting and reinstalling), but when trying to open a dynamic link it opens Safari instead, there we have the "open" button that opens the app store page of this app.
When trying to long tap on the link as suggested by developers that experienced the same issue, we have only one button that says "Open" which opens Safari again. I would expect that when the app is installed we would have two options:
1. "Open in Safari"
2. "Open in [App]"
Has anyone experienced this issue before? Anyone has any idea how to solve this?
The overall diagnoses here is that Universal Linking is not configured properly on the device. If Universal Links works on all other devices, then it is probably the case that the AASA file is not being downloaded properly. iOS 11.2 has had issues with this recently.
Check device logs
I suggest that you check the device logs when installing the application to see if the AASA file is being downloaded properly.
1) Delete your app and plug in the device to your computer
2) Open up Xcode and navigate to Window > Devices & Simulators
3) Select the device in the left-hand menu
4) In the bottom of the window you should see a triangle in a box. Clicking this will bring up the device logs.
5) Use a cmd-f to search for applinks and if your app downloaded the AASA correctly. You should see something like
Added service 'applinks', appID 'RXXXXXXXP.io.branch.Branchsters', domain 'branchster.app.link'
If this is not the case, then it looks like you AASA file is not being downloaded and you may need to delete the app, restart your phone, and try again.

Universal Link broken in iOS 11.2

I am using Branch deep links in an app for sharing links to content in the app via social media. Everything was working fine quite a while.
When updating to iOS 11.2 I encountered the following behavior:
1) After the update the Universal Links still worked.
2) I uninstalled the app and reinstalled it.
3) Since then, all links always open the Branch deep view in Safari.
4) Tapping "Open The App", opens the AppStore.
It does not matter in which app I tap on the link (Notes, WhatsApp, Messages, Facebook, ...), it is always the same behavior.
The Universal Link was not bypassed by tapping the "go to link" button in the upper right corner (when app was opened). I tested on three different devices (iPhone 5s, iPhone 6s, iPhone 7). All led to the same result.
I found out that there was a bug in iOS 11 beta 2 which was fixed in the beta 3 (Ios 11.2 beta universal links open my app and safari), but it might have reappeared?!
Anyone having the same issues or a way to fix it?
Sometimes universal links don't work on iOS 11.2 for newly installed apps.
The symptoms are that clicking on a universal link won't open an app that is newly installed on a phone. The universal link takes the user to a web page and is prompted to download the app again.
Through testing here at Branch HQ we've discovered that the Apple App Site Associated Domains file (apple-app-site-association file) isn't always downloaded after the app is installed, either when it's installed from the app store or from Xcode.
Removing the app, restarting the phone, re-installing the app, and waiting a minute or so seems to clear this up. This is a horrible user experience obviously.
We have filed a radar with Apple and will continue to track this issue.
Mitigations
Set $uri_redirect_mode
Setting the $uri_redirect_mode option on links can have Branch try to force the link to open the app, even if it might show an error to the user. You can read about this option here, in the Branch docs.
Here's more info about turning on $uri_redirect_mode in your Branch Journey or Deepview banner, the web snippet that Branch shows the user if the ends up deep linking into a web browser:
Advanced Journey Configuration
Deferred Deep Linking Mitigates This Problem
This issue is mitigated by Branch's deferred deep linking tech: If the user opens the app from their home screen after the universal link is clicked, deferred deep linking still works, and the link content is shown in the app.
As an addition to #clayjones94's Answer, I have been unable to get my iPad 2nd gen (iOS 12.1.1) to recover the ability to use Universal links after switching between release and debug targets.
Yesterday it suddenly started to work, but then after changing build-target, the universal link has again broken.
I've uninstalled, rebooted, installed, rebooted and so on.
I was, however able to test the functionality in a simulator, so for now, I would recommend attempting a fresh simulator to make sure your AASA file is correct on the server.
EDIT: if you have a proxy involved, that may also break the validation between the app and the website

Branch.io Deeplink not working in safari in ios 9, But it works in chrome

Deeplinks working perfectly when using chrome iOS app. But in safari it stopped working and it always redirect to the appstore page even the app is installed or sometimes pop a alert saying "safari cannot open the page because the address is invalid". Everything works perfect few days back. so my guess is this happens after the ios 9.2 update. Any solution for this?
UPDATE
I have tried using a new phone(Which app not installed before) and installed the app.
Deep links works for both browsers (Safari and Chrome).
If you push the bnc.lt forward button it opens App Store for both Safari and Chrome.
Next time you open a link deep link:
Safari: It asks if you want to open the link in app store
Chrome: It asks if you want to open app and at the same time redirects to app store. If you click open in app next time you click a deep link it will open in app.
So in other words you can still open the app from Chrome after clicking the bnc.lt forward link in staus bar. This is because Chrome asks for opening the app and not app store.
For Safari i end up in an irreversible state where the deep link always open app store and not the app.
Alex from Branch here: this is the expected behavior. Unfortunately our fallback options are rather limited at the moment, due to the changes to Universal Links in iOS 9.2.
TL;DR: it's a bit of an edge case that most users wouldn't encounter, but you can easily work around it by making use of our Deepviews functionality.
Basically, here's the logic behind what you're seeing:
When you open the link on a device without the app installed, you end up on our bnc.lt server, and we redirect you to the App Store so you can get the app. This is good.
When you open the link on a device with the app installed for the first time, your device detects the Universal Link and opens the app immediately. All this happens locally on your device, and you never even get to our bnc.lt server. This is also good.
When you push the bnc.lt forward button, you're telling your device 'I don't want you to immediately open the app...show me the web content for this link instead'. In the case of a Branch link, this 'web content' is simply a redirect to the App Store. At this point, Branch has no way to know whether you the app is installed or not, so we have to assume it isn't and you get the same treatment as 1. above. This is not so good, but right now we don't have any better options due to the way Apple has designed the system.
The next time you open a link, your device remembers that you pushed the bnc.lt button in the past and just takes you straight to the web content. I'm not sure why Safari does it this way, because I can't imagine many situations where this would be desirable and it is leading to a lot of confusion for users.
The real problem here is that when you press bnc.lt to bypass the app, your device remembers this preference and executes it every time it sees a bnc.lt link in future. Chrome still 'works' because it is proactively confirming the preference each time in 4., whereas Safari just plows forward. There are a few options for what happens next:
In Apple's ideal world, you'd end up on a normal webpage where you could simply scroll up and use the Open in app button to reverse this preference. But since Branch is immediately redirecting you to the App Store, this isn't an option. You could consider using our Deepviews feature, since this does provide some real web content in place of the immediate App Store redirect you're seeing right now.
In most situations, you can still long-press on the link and select Open in app, but this doesn't help users who don't know the option is there.
In the worst-case scenario, you end up on the App Store page and just press the Open button (instead of Install). Thanks to Branch's magic, you'll still end up in the right place!
Now from iOS 9.2, Apple no longer supports URI schemes for deep
linking, developers must implement Universal Links in order to deep
link properly on iOS.
Universal links let you replace custom URL schemes with standard HTTP or HTTPS links. Universal links work for all users: If users have your app installed, the link takes them directly into your app; if they don’t have your app installed, the link opens your website in Safari.
To learn all about universal links, see
How to support Universal Links in iOS App and setup server for it?
Example
https://github.com/vineetchoudhary/iOS-Universal-Links
UPDATE [1]
How Branch links work (Branch.io)
If you take a lock at fundamentals of Branch's contextual deep links. You found Branch.io also using traditional deep-linking
1. Creating links
When you’ve integrated the Mobile SDK, you can create a Branch link every time a user clicks to share or invite another user from within your app. Your app makes a call to Branch.io, and Branch.io return a Branch link.
2. Tying data to links
3. Clicking links
4. Using data
Check the Clicking links step, Branch.io just map your website URL with your app URI scheme but URI schemeno longer supported by Safari. So, move to Universal Links is only the option in order to deep linking in iOS 9.2 or you can wait for some solution by Branch.io. Thanks.

What could cause iOS Universal Links to stop working?

I had Universal Links working on my iOS 9 app. If I clicked on a UL from an email or text message, it would launch my app as expected.
Then I added a QR Code Reader and used openURL() open the UL embedded in the QR Code from within my app (which was supposed to be handled by the app itself).
On one test run, the URL embedded in the QR code was malformed: it had a CR/LF at the end of it, and when the app tried to open it, it crashed (I do not have the crash log/trace unfortunately).
As I researched the crash I realized that openURL() is not designed to work with UL, so I fixed the code to have my app handle the URL differently, but now none of the ULs work with my app anymore: what used to work from an email or text message doesn't anymore (it launches Safari instead of my app).
I install my app via TestFlight and I can see from my backend that the apple-app-site-association file is being pulled, but it still won't work.
Important data (that's how I know the problem is with the state on that specific phone): the same app on a different phone opens ULs correctly.
It's as if the one bug I ran into put the phone in a state that will always launch Safari for those URLs no matter what.
It is the only phone that exhibits this problem.
What I tried without success:
uninstalling the app completely
reboot
Not sure what to try next. Thanks in advance for the help.
You probably clicked on the link in the top right corner of the status bar to open one of your ULs in Safari. After that all subsequent ULs will open in Safari.
In Safari, pull down the page until you see the Smart-App-Banner at the top. Then click on 'Open' and ULs should work again.

Resources