0

I'm using Universal links to process an HTTP URL if our app is installed.

This is working fine.

Here is my problem: There are limitations in SFSavariViewController so I can't use my url in a wevbiew, only in the browser on iOS 12.4.6 and up. On older devices, the URL is handled just to say that this not supported because of Safari limitations.

Because we also have an Android and Web application and for the sake of simplicity, we're sending an email to the user with the same http link that I want to handle, in both app when installed or through a web browser if not.

Why is that? Because the user is already anthenticated in the app, we call the server to generate an auth token that we'll use as an additonnal parameter to the HTTP URL the user clicked on.

On Android we open a Webview activity, so far so good.

On iOS I need to go back to Safari with this modified URL, but because I registered the URL to open the App, sharedApplication.openURL does nothing (probably because we're already in the app):

UIApplication.SharedApplication.OpenUrl(new NSUrl(targetUrl));

Here is my apple-app-site-association file:

{
    "applinks": {
        "apps": [],
        "details": [
            {
                "appID": "52CCCFRG4D.com.hygeex.yakaetp",
                "paths": ["/etp/webapp/conf_view.html"]
            }
        ]
    }
}

The URL that is sent by mail

https://mywebsite/etp/webapp/conf_view.html?r=40

The URL once processed by the app to add the token:

https://mywebsite/etp/webapp/conf_view.html?r=40&tk=ABCD.....GTYU

It seems there is a way to specify GET Parameters in the association file staring with iOS 13 but what about older plaforms? And I'm not even sure that will help in my use case.

May there is another solution that I've not seen yet. I did not found a way to launch Safari without using sharedApplication.openURL... Is there another way?

By now you should have understood that I can't simply return false from ContinueUserActivity.

Any help appreciated.

  • Your described behaviour doesn't sound correct. If you call `openURL` from your app for a url that matches your universal link path it should open safari as the assumption is that your app cannot handle that specific URL. – Paulw11 Jun 01 '20 at 09:13
  • You are right. My problem is that I have to make an synchronous call to a web service to get the token. It seems that if I exit ContinueUserActivity method prematurely before calling openURL this does nothing. –  Jun 01 '20 at 14:22
  • But still, I managed to get Safari to start to open my URL but only to be redirected back to my app (ContinueActivity). So now I'm trapped in an endless loop. –  Jun 01 '20 at 15:42
  • It would be better to open the web in WKWebview instead of open it in safari . – Lucas Zhang Jun 05 '20 at 07:18
  • @LucasZhang-MSFT I can't because my web page needs access to camera and microphone and I can't handle the requests from within the WKWebView, only in Safari AFAIK –  Jun 05 '20 at 07:26
  • User Permission are available in WKWebView . You just need to add the relevant privacy in Info.Plist . – Lucas Zhang Jun 05 '20 at 07:34
  • @LucasZhang-MSFT The whole internet suggests the contrary, And if I do remember correctly, my tests shows that [getUserMedia is indeed unsupported](https://stackoverflow.com/a/49467964/15186). –  Jun 07 '20 at 08:41

0 Answers0