iOS Universal Links sometimes stops working - ios

My app supports universal linking and in most cases it works without any issues, tapping on a link opens the app like it should.
But sometimes, i'm not sure why, it stops working.
It happened a few times to one of the users, tapping on the link stopped opening the app and instead it opens the web.
And from that moment there is nothing you can do to make it work again.
I know that if you tap on the link in the top right corner on the status bar, it disables the universal linking and from that moment tapping on a link will open the web. and to re-anable universal linking you can tap the link on Notes App(for example) and tap the "Open in MyApp" button.
But this doesn't seems like the case, the user told me he is not pressing the link on the status bar, and even more weird, when trying to re enable the universal linking by tapping the link in Notes App, the "Open in MyApp" button is missing.
Any ideas what could cause this issue?

Based on my previous experience it could happen for various of reasons:
Most likely: apple-app-site-association is not available for user or is available with insecure connection. Here are possible origins of such problem, I am sure there are others as well:
User does not have internet or connection to your site/apple-app-site-association file on your site. Even though it should redirect to your app, Universal links feature needs to check existence of this file on site. It's done first time at app installation and each time you open your link (I checked on iOS10.3 with Charles). Note, that it does not wait the check to be completed and shows or does not show "Open in MyApp" button based on previous check. Even if user has internet on, your site could be blocked by firewall or something.
User has access to apple-app-site-association file, but he access it from a network or via a proxy that requires you to accept some certificate in order to decrypt your HTTPS access. Hence your HTTPS traffic became insecure. iOS checks that and fails validation of apple-app-site-association file.
User has access to apple-app-site-association file with good secure connection now, but previous access failed because of previous reasons -> user won't see your app opened this time or "Open in MyApp" button in context menu for reasons I described before. How to fix that? No idea, just try couple of times all the time.
You already declined that option, but just for future readers. If user taps on top right button with site name - all future transitions will redirect user to Safari instead of your app, until user tap this button again. Basically, iOS saves last user choice.
There are a lot of other reasons for that to not work, but in those cases there will be some 100% specific steps to reproduce, like does not work for certain /path or for debug/release candidates or for test server. It seems that is not your case so I won't cover it here.
Helpful links (quite a lot of repetition, but if you stuck, it's worth to repeat it):
App Search Programming Guide: Universal Links
Troubleshooting Universal Links
Sailthru's Universal Links: Troubleshooting and FAQ
The things I hate (and you should know) about Apple Universal Links

To me it happens the association file is sometimes not downloaded upon the app's installation even when the device can access the file from Safari.

Related

Is there a way to avoid opening the link in browser

When using Huawei App Links (Because Firebase dynamic link doesn't work for Huawei App Gallery), this is the kind of long link that is generated.
https://example.drcn.agconnect.link/?deeplink=https%3A%2F%2Fexample.com%2Freferral%2F3c3432x&android_deeplink=https%3A%2F%2Fexample.com%2Freferral%2F3c3432x&android_open_type=2&android_package_name=com.example.mobile
When clicked on this link on an Android(Google) device where my app is not installed, I see these options:
"Open" - opens the deep link i.e https://example.com/referral/3c3432x in a browser
"Download" - opens the Google play store app with my app page
The download behavior is fine, but I don't want the open behavior, since that link actually does not exist. I understand this link still be accessed on a desktop and might try to go to the link on a browser, but for now we are okay showing 404 in such cases.
Is there a way to avoid the "Open" option? Or better would be to stop showing this screen and immediately redirect to application if installed or play store of not installed. Just like how Firebase does.
I even tried the option of landing_page_type=2 as listed here: https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-applinking-createlinks-defined-0000001055514692 but that doesn't seem to work, it always show the Open/Download page irrespective of the value.

How do you request a passcode entry when linking out from an app

My app keeps failing Apple's review process because it's rated for kids, yet links out to websites without parental controls. I was wondering if there is anything I can put in the HTML link that will force the use to put in their passcode (or thumbprint) before jumping to the link?
I have no idea where to start with this. Google has turned up nothing.
When you click a link in the app, instead of taking you straight to safari, it instead asks for a passcode first. This would satisfy the parental controls issue.

Is there a way to force iOS to *not* deep/universal link from the browser?

I am having a real hard time finding an answer to this. I know that the app manifest itself can exclude links, but I have an active bug that is affecting users and updating the app is not a fix for current users unfortunately.
The issue is that on our mobile site, we have a flow where it redirects to another domain, an then redirects back. On that 2nd redirect back, if our app is installed on the device, the app will briefly open before switching back to the browser. When this happens, the page breaks (as the 2nd redirect is actually a form submission (a POST) and the app can't forward that POST on.
Is there a way we can add a header or a param or something to tell iOS to not try a deep/universal link? Something to just use safari?
Not with headers
Unfortunately, the device will only make a request to the Universal Link if it does not find a matching AASA file on your device. It will perform a handoff to your app which is done on the local OS with no requests. Therefore, there is no way to check the headers of the request if the device recognizes it as a Universal link.
Same domain fix
The only case in which Universal Link will use the browser if the app is installed is when a is already on the Universal Link domain when they click the universal link.
Example: If a user is on example.com on Safair, they have an AASA on their device that has applinks:example.com, and they click a link that redirects them to example.com/item123, they will not open the app.
In your case, you leave the domain and come back. Your best bet is to figure out a way to redirect the user while keeping them on the same domain. I know that probably doesn't help a ton, but that's your best bet.

Branch.io how to migrate from universal links on primary domain

Currently we have universal links which look like http://example.com/sharing/< id >/ which open our iOS app through the safari smart banner. But smart banners sucks, so we'd like to use the Branch.io journeys banner, which actually appears when people load the page. Since these links are already in the wild, they need to continue to work have have some way into the app. In the future we'll generate branch.io sharing links from inside the app, but these landing pages on the web will continue to exist.
I'm calling branch.init('key_test_foo'); from javascript, and the Journeys banner appears. It only ever shows the "Get" button and never "Open". I'm not clear how I pass the object ID through branch.io so that the app can navigate to the right place.
The app is built in Xamarin, and I think I have the integration built correctly following the example. It is not in our production build through the app store, I'm just running the app through the debugger in Visual Studio.
I'd even settle for an "Open in App" link like imgur has, as long as there's something I can click in safari to open the app in the right place.
I don't feel like I should have to "make a link" every time this page gets viewed, right?
EDIT:
One additional question. I think I want to change my og:url so that when facebook scrapes my page, it will open through branch (instead of back to my site). But how would I set that? Facebook isn't going to run any JS when it loads the page is it? Can I just set it to my.app.link and magic will happen from the al:ios:url that drives the deeplink routing?
I think this: https://stackoverflow.com/a/34596340/401636 might be the solution.
1. The Journey's banner navigating to your app.
Branch uses the domain of the format -alternate.app.link domain for the link behind the Journeys button. To ensure that clicking on Journeys CTA, navigates to your app ensure that you have added the -alternate.app.link domain for your app in the 'Associated Domains' file. You can check the documentation providing information on how to add the domains here.
2. The Get v/s Open issue for the Journeys CTA
Branch uses a variable has_app to determine whether the device has the app or not. For this variable to be set to true, a user should click on the Journey CTA and be redirected to the app (not the App Store). Also, the issue of the CTA not updating is common during development, because the app is frequently re-installed on the device. Due to this testing, the flag, has_app, goes in a faulty state.
To force reset the has_app variable to change the Journey's banner CTA from 'Download' to 'Open', please follow these steps:
Click on the Download button - this should redirect to the Play or App Store
Install the app
Return to the web page with the Journeys banner, which should still display the Download button
Tap on the Download button again - the app should open
Close and then re-load the web page with the Journeys banner - the banner should now have an "Open" button
Tap on the "Open" button
Please note that the above steps are required only during development mode for testing purposes. Out in the wild in production, users will not see this issue. Also, it might take some time (as long as 30 minutes) for the flag to updated.
3. Navigating to the right place in your App
If you plan on using your old domain links for deeplinking, you can update your Link domain on the Branch dashboard to the domain your links are currently using. You can then recreate the links again with the Branch API. Please note, Branch will be the authoritative registrar for your domain and you cannot host anything on this domain.
If you do not wish to do that, you can append additional link parameters to your Journeys button. These link parameters will be available in your app when the user clicks on the Journey CTA and is redirected to the App Store/your app. You can refer to the documentation here for more information.
For both the above scenarios, in order to read the link parameters in your app, you should integrate the Branch SDK in your Xamarin app. (Reference documentation here)

Force open app using Apple Universal Linking

I have Universal Linking setup in my app.
Now when browsing my website in Safari and visiting a UL registered link, it opens in safari and asks me if I want to open in my App.
Is there a way that it always opens in the app? No prompt to open in app, just open when it is installed, else continue in safari.
There are two different issues here:
1. In Safari, the URL of a Universal Link needs to be on a different domain/subdomain than the page on which it appears
Apple is very conservative with where Universal Links are allowed to work. One of the limitations in Safari is not allowing the app to open if the user is already browsing the same site (this sort of pages sense — if the user made the effort to open a site in Safari instead of the app, it could be annoying if every single link on that site tried to open the app, especially if the app isn't properly configured for deep link routing).
The workaround is to use a separate domain/subdomain for links you want to open the app. For example, if your site is on example.com, point any link you want to open the app to link.example.com and then redirect users without the app back to the main website or onward to the App Store. This is actually the system we built at Branch.io (which you could consider using instead of re-building it yourself!)
2. What you have described is not Universal Links behavior
Universal Links do not ask the user for confirmation before opening the app, even the first time. They always open the app immediately without even requesting the web page, until/unless the user explicitly disables them (which is actually rather easy to do). What you're describing is the behavior of custom URI schemes, so I suspect you may have a some sort of automatic redirect to the app's URI scheme on the page the Universal Link points to. This is actually not the best idea in most cases, since users without the app will see a nasty error message.

Resources