Custom URL scheme without confirmation prompt (Swift)

I found two options for opening my application from the Safari web page: a custom URL scheme created in my Info.plist application project or Apple Universal Linking. The custom URL scheme is obviously the easiest to configure, but the problem I am facing is that Safari displays a confirmation window asking β€œOpen myapp ?”. first, and the user must click "OK" before the application really opens. I want my application to open automatically as the scheme opens, and they tell me that the only way to do this is through Universal Linking (please correct me if this is incorrect). If this is true, however, I would like to know if it is possible to somehow put the required apple-app-site-association file in the http:// domain instead of https:// ? According to Apple's official documentation, the correct Universal Link format begins explicitly with https:// , but my domain name cannot be uploaded to https:// without redirecting several times, and this will ruin the web services that I wrote to perform other tasks in my application. Two main questions that I left after this problem:

1) Is it really impossible to bypass the confirmation prompt using a special URL scheme ( myscheme:// )? If this is not possible, how can I do it?

2) If I need to use Apple Universal Linking, can I use the http:// domain? If so, how do I do this? Right now, if I download a universal link, it just shows the dictionary inside the apple-app-site-association file, which I am sure should not happen. I was told that he should send the NSUserActivity object NSUserActivity my application delegate. How to do this using the http:// link?

+5
source share
1 answer

It is not possible to start a custom URI scheme without showing a warning to the user. This was possible in iOS 8, but iOS 9 started showing a warning for all applications. And iOS 10.3 extended this even to the App Store itself. You cannot get around this. Generic links were created to replace URI schemes for this behavior, so you need to use them instead.

From your description, I think you may not understand how Universal Links work. To answer the initial questions that you asked at the beginning, the URL of the universal link itself should not be included in the https:// protocol, and yes, apple-app-site-association should be passed through https:// without redirection.

However , it looks like you are trying to maintain the contents of the apple-app-site-association file for each universal link. This is not a proper implementation - the AASA file is only located at https://example.com/apple-app-site-association , and iOS automatically extracts it when the application is installed. After that, any example.com URL that matches the criteria in the AASA file will be eligible for universal links.

All of the above, you really do not want to create this system yourself . I suggest looking for dynamic links from Firebase or Branch.io (full disclosure: I'm in the office).

+5
source

Source: https://habr.com/ru/post/1266955/


All Articles