问题
I have 3 requirement for DeepLinking or Universal Links to my project.
- If user is having the application then URL should redirect to application with content.
- If user don't have the application then it should redirect to Appstore.
- If user don't have the application then it should redirect to Appstore and after download the app it should go to that page with data which I am sending with URL.
Links which I followed:
- https://www.raywenderlich.com/128948/universal-links-make-connection
- https://developer.apple.com/library/content/documentation/General/Conceptual/AppSearch/UniversalLinks.html.
- http://swiftdeveloperblog.com/deep-linking-using-custom-url-scheme/.
- http://blogs.innovationm.com/deferred-deep-linking-in-ios-with-universal-link/
- https://developer.apple.com/documentation/security/shared_web_credentials/preparing_your_app_and_website_to_share
- http://www.brianjcoleman.com/tutorial-deep-linking-in-swift/.
What I understood is:
Creating and Uploading the Association File and for this I have to follow some steps:
Adding support for universal links is easy. There are three steps you need to take:
Create an apple-app-site-association file that contains JSON data about the URLs that your app can handle. Upload the apple-app-site-association file to your HTTPS web server. You can place the file at the root of your server or in the .well-known subdirectory. Prepare your app to handle universal links.
Creating and Uploading the Association File
To create a secure connection between your website and your app, you establish a trust relationship between them. You establish this relationship in two parts:
An apple-app-site-association file that you add to your website A com.apple.developer.associated-domains entitlement that you add to your app
Preparing Your App to Handle Universal Links.
In your com.apple.developer.associated-domains entitlement, include a list of the domains that your app wants to handle as universal links. To do this in Xcode, open the Associated Domains section in the Capabilities tab and add an entry for each domain that your app supports, prefixed with applinks:, such as applinks:www.mywebsite.com.
Problem is: I followed all steps and I have a url I added it in the domain in my Associated Domain.
Example: https://<My_Domain>/anything
.
Now Backend is generating URL and sending.
We are using Http
server.
Example:
Route::get('appstore',function(){ return redirect()->away('https://itunes.apple.com/in/app/whatsapp-messenger/id310633997?mt=8');});
Problem is when I am clicking on that URL I am not getting any popup for already app and also After download how data I will get ?
Am missing something or backend is missing something?
回答1:
So it seems like you are trying to accomplish deferred deep linking, which means you route the user to the content if the app is installed or you route the user to the app store to download the app and present them the content once the app is opened. This is very difficult to do by yourself and I'll explain more in a bit.
It looks like you are setting up your universal links correctly but the redirect to the app store is fairly hacky. Universal Links are meant to be used to redirect users to the web version, which means bringing them to the app store instead is no easy task.
If you do get the user to the app store, deferred deep linking which is just directing them to the content after they install the app is nearly impossible to do yourself without using a third-party service like Branch. Branch also will allow you to push users back to the app store to download the app, if that's the user experience your looking for.
Hope this helps!
来源:https://stackoverflow.com/questions/46055847/how-to-implement-deeplinking-if-user-dont-have-app-then