1

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?

K. Ondřej
  • 55
  • 8

1 Answers1

1

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

  • Yes thats what Im looking for but as I understand from the documentation URL schemes allows only URLs such as example://data. I need that url to be in format htttp://google.com/abcd/abcdefg. Do I understand it right? Because when I tried adding URL scheme to app, clicking on link forwarded me to 404 webpage instead of app. – K. Ondřej Aug 25 '20 at 13:06
  • Can you show me how you configured url scheme and which URL did you try to add? – Alexander Nikolaychuk Aug 25 '20 at 13:07
  • https://imgur.com/a/sKUlChl after clicking on url in email the app should start – K. Ondřej Aug 25 '20 at 13:29
  • It should start if it is exist on your phone or open APP store (if you dont have it on your phone) – Alexander Nikolaychuk Aug 25 '20 at 13:47
  • The URL in mail looks like this http://medirol.cz/vivera/nositka?value=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyjk0kiLCJpYXQ0sbS0niDkHi2aHn2rwMTB9.1HhdfgIP9wVjgWxgFOjz5bkaM2IxNDY5MzU2JsaWNlbnNlSasdWQiOiI1ZjJiZjdhYMDEzMjKiOjE1OTY3MTcZShzD9s – K. Ondřej Aug 25 '20 at 13:53
  • But when i click it iPhone asks me where to open it, i choose safari and safari just loads 404 webpage and my app does not react – K. Ondřej Aug 25 '20 at 13:53
  • Medirol.cz is a your registered URL scheme? Or it is just site domain? – Alexander Nikolaychuk Aug 25 '20 at 13:54
  • It is not mine, thats just random domain, I could use for example google.com. This worked on android platform very well but I can't get it work on iOS – K. Ondřej Aug 25 '20 at 13:57
  • Yoy need to create some custom URL scheme, you cant just use domain like medirol.cz or google.com it should looks like - medirol-app:// for example – Alexander Nikolaychuk Aug 25 '20 at 13:58
  • I've tried that and it worked when I put it in safari but I want to have hyperlink in email where user clicks on the URL and phone opens the app. But medirol-app:// doesnt register as a hyperlink – K. Ondřej Aug 25 '20 at 14:01
  • You need to register this in app. Did you add aURL scheme to the app! – Alexander Nikolaychuk Aug 25 '20 at 14:08
  • I already added an URL scheme in app but still I can't get the clickable link to mail – K. Ondřej Aug 25 '20 at 14:21
  • you need to add this link inside the email, and after a click on it - the app should open. How does your link look like? Also, you need to add this method to AppDelegate func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) – Alexander Nikolaychuk Aug 25 '20 at 14:35
  • I figured out why it didnt work. I used Gmail and URL schemes works only with iOS mail. – K. Ondřej Aug 25 '20 at 14:40
  • WAIT, can you use native mail for test? – Alexander Nikolaychuk Aug 25 '20 at 14:41
  • Yes, I've already tested with native mail and it worked well. The only issue is that it doesn't work with G-Mail, which is quite limiting for user. – K. Ondřej Aug 25 '20 at 14:47
  • https://stackoverflow.com/questions/39245852/ios-universal-links-not-working-from-gmail-app – Alexander Nikolaychuk Aug 25 '20 at 14:51
  • https://stackoverflow.com/questions/40289218/ios-9-universal-links-dont-work-from-google-apps – Alexander Nikolaychuk Aug 25 '20 at 14:51
  • Google app is another app, not Apples. And it looks like impossible. Only work from the native Mail app – Alexander Nikolaychuk Aug 25 '20 at 14:52