iOS deeplink (universal Link) through sub Domain - ios

I have read a lot of articles regarding universal links but still i need to be clear regarding few things.
I have to add universal links to http://www.domain.com but due to certain reasons i will not be able to make my website SSL certified or even put apple-app-site-association with https in root folder. So I thought of doing this in a different way, i will put apple-app-site-association file in the root of a subdomain, lets say https://www.app.domain.com/apple-app-site-association
Then i will open every universal link with that subdomain whenever universal link is available and redirect https://www.app.domain.com to http://www.domain.com if universal link is not available.
Questions in my mind :-
apple says - file needs to be accessible via HTTPS—without any redirects—at https:///apple-app-site-association.
In this line what does apple mean by without any redirects ?
when apple does not find any universal link related to a particular URL, will it itself redirects it to safari.
Is this a safe way to add universal links or is it necessary to have our main domain on https or at-least apple-app-site-association on https

This should work fine. To explicitly answer your questions:
'Without redirects' means when iOS requests https://www.app.domain.com/apple-app-site-association, it must find the file at that address. You can't have a redirect of any kind (Javascript, 301, 302, etc)
If a URL is not valid for Universal Links because you didn't cover it using the inclusion rules in the apple-app-site-association file, it will be opened using Safari. If the URL is on another domain without a valid apple-app-site-association file (e.g., http://www.domain.com/), then it will also be opened in Safari.
Yes, it's fine. Definitely a workaround, but not unsafe.
You should also investigate a hosted deep linking service like Branch.io (full disclosure: I'm on the Branch team) or Firebase Dynamic Links. These will give you all of the same benefits (plus a bunch more flexibility, to be honest) without any of the setup headaches.

We experienced ways where a 302 on iOS works.
In general I fully agree that Apple officially does not seem to support any redirect.
The following cases have been tested on an iPhone 6 running iOS 11.
These cases work :
Website in Chrome on iOS: User clicks on link A and a 302 redirects him to a Universal link B.
Website in Safari on iOS: User clicks on link A and a 302 redirects him to a Universal link B.
Gmail App on iOS: User clicks on link in email and Gmail opens external Chrome browser, which opens a Google link which redirects to link A which redirects via 302 to Universal Link B. (this case works only if Chrome is installed and in Gmail Settings the user explicitly changed the default browser to Chrome)
These cases DO NOT work:
Apple Mail: User clicks on link A in email and external Safari is opened. 302 happens and opens Universal link B. Result: App does not open
Gmail App: User clicks on link A in email and Gmail inAppBrowser (probably WKWebview?) is opened. Gmail redirects EVERY link from an email over a google server, as a second step link A is opened (dont know via 302 or other method) then 302 happens and opens Universal link B. Result: App does not open
Unfortunately you can see that in some cases it does NOT work. As these cases, Apple Mail and Gmail on iOS are very important for most of us here, I think this is a showstopper and you should not use it.
We tested with Adjust links and therefore in cases where the app does not open Adjust opens the AppStore to download the app.
For all Adjust interested: We tested by opening a link https://app.adjust.com/... which has a 302 on the respective Universal link https://XXXXXXX.adj.st/... on which our app listens.

Related

iOS URL scheme or not existing Universal Link

I was developing Android App that could be opened by url link sent to email. The domain exist but the path not (ex. google.com/abcdefgh1234). Im not an owner of the website so putting AASA file there is not possible. The link also contained jwt with some info that I was handling in the app. I wanted to do the same on ios but what I found, URL schemes doesn't support http and Universal Links need special file on that website. Is there a way to handle this on iOS?
You can check custom URL scheme https://developer.apple.com/documentation/xcode/allowing_apps_and_websites_to_link_to_your_content/defining_a_custom_url_scheme_for_your_app
It will work without adding special file to the server. You need only a special link and after a tap on it, you will be redirected to that app (if it exists on your phone). Maybe this is what are you looking for

App search API validation tool gives request time out

I am working with universal app links. I had put my apple-app-site-association on my server root https://www.example.net/
It works fine for all links except https://www.portal.example.net/
When i validate this link in https://search.developer.apple.com/appsearch-validation-tool it gives fetch request timeout.
Note : In portal we redirect page to website homepage (https://www.example.net/)
This is expected, due to the design of the Universal Links specification.
Here's why: https://www.example.net/ and https://www.portal.example.net/ are completely different subdomains of https://example.net/.
The Universal Links specification says each subdomain must be verified with its own apple-app-site-association file, which means a file hosted at https://www.example.net/apple-app-site-association will not work for any link on https://www.portal.example.net/. Redirects are not followed.
To fix this, simply host a file at https://www.portal.example.net/apple-app-site-association with no redirects.

iOS Universal Links and URL Shorteners

We have recently begin to encounter issues with our Universal Link implementation when the UL is accessed via a shortened goo.gl URL.
This Works: https://site.domain.com/Deep/Link
This does not: https://goo .gl/fake -> 302 Redirect -> https://site.domain.com/Deep/Link
Is anyone else experiencing the same thing?
Note: I had to break up the shortened Google URL to keep StackOverflow's editor from yelling at me.
Universal Links are triggered by the URL that is being accessed, and are ignored if a redirect is not triggered by explicit user action. Since goo.gl isn't registered to your app (and cannot be, since you don't control it), burying your URL behind a shortened link is bypassing Universal Link detection for the destination domain.
There is no good workaround for this on goo.gl. The best option is to set up a URL shortener on a custom domain that you CAN register with your app for Universal Links. Alternatively, Branch.io (full disclosure: I'm on the Branch team) or Firebase Dynamic Links could handle this for you, since both essentially set up a custom link shortener on a domain they control for Universal Links on your behalf.

iOS deep linking is stripped out in Gmail

I'm trying to send an email with deep linking to my iOS app, using myapp:// format to open it up from email. It works (i.e. tapping on it opens the app) in any iOS mail client (Mail, Mailbox, etc.) but not in Gmail app (or even web), that strips it out leaving text only. Does anyone has a solution/alternative beside creating a web link that redirects then from browser to app?
Nope, unfortunately Gmail detects non-http/https protocols in links and strips the anchor () tag (so using data: or javascript: to perform a redirect is out too).
If/When Google implements Actions on Gmail for iOS/Android, those may work (https://developers.google.com/gmail/actions/actions/actions-overview), but as of now, they are not rendered on native mobile clients.
You can create a server with a regular endpoint that will redirect to the "special" myapp:// link.
If you are running Node + Express, here's an example of a middleware that does exactly that:
https://github.com/mderazon/node-deeplink

custom url schemes in twitter posts it does not work

I am an ios app developer. We have implemented a custom URL scheme 'my_app://section_name' or so where if the link is opened in the user's mobile browser, it will redirect the user to a specific section in the app.
We would like to be able to tweet these URLs and have users on their mobile device click on them to open up the app, however it just can click once
(when you click close , maybe you click wrong then you want to click it second but it does not work )
I hope this isn't too silly of a question. Thanks
Make sure to check the tweet body after it have been posted.
This may be due of an URL shortener, especially if the tweet is posted from the iOS 5 Twitter framework.
I'm having a similar issue with url schemes. We can include them in emails and text messages, and they highlight and work properly.
Unfortunately, when we do the same with a tweet, the iOS Twitter client fails to recognise the special URL scheme and so the user cannot tap on it to open our app.
Pretty big oversight, methinks. Anyone else had any joy including special URL scheme links in tweets?
A solution that you should consider involves not sharing the URI scheme directly, but rather creating a page on your web server to handle this. In fact, if you want to be able to share full URI schemes with paths, you're better off building a web server to dynamically generate a page with a URI scheme redirect.
This is a over-simplified representation of what we built at Branch. This includes some code to get you started though the web server will require a bit of setup not described here.
instead of testapp://some.data.here, you'll link to http://yoursite.com/hosted-redirect/some.data.here.
your server should listen at the route /hosted-redirect, grab some.data.here and build the following page (body here):
(source: derrrick.com)
So your server will have to generate and respond with this page, filling in some.data.here, anytime http://yoursite.com/hosted-redirect/some.data.here is requested.
A lightweight node app could do this with a single file.

Resources