Deep Linking in iOS - Navigate to Apple Store if app not installed - ios

I need to implement Deep Linking concept without using any third party libraries (Branch and etc..). The link (starts with http/https) will be shared from app through Message, Email or any Social media apps. By tapping on shared link I want to open corresponding app if its already installed on device else it should navigate to the Apple Store to download the app.
I have knowledge on URL schemas but it works only when the app is already installed on device and the schema URL format also be different (like fb:// for Facebook app).
I have also done some R&D on Universal Links but I don't know whether it supports for dynamic links as for me the link will be combination of base URL(static) and referrer key(dynamic). I also need to track the referrer information once the corresponding app is opened like who referred this app (referrer details).
e.g: https://domain.com/ReferrerID
Can you please help me on it. Thanks in advance.

To make it clear on Universal Links in iOS will not take you to Apple Store if app is not installed on device. When you click on a link then Universal Links helps you to open the app if the app is already installed on device else the same link will be going to browse in Safari. When the url browse in Safari then we have to run JavaScript to navigate/redirect to Apple Store.

Yes you can support universal links to your application from iOS 9 or above. You can generate dynamic links and have deferred deep linking also.
Follow this steps its simple Click Here
For the file mentioned in the link you need to add that file in the root of your website which consists of the path valid for deeplinking. And that file should not have any extension.
Then validate your domain at Here.
After that you can add all the domains thing in your associated domain under the project capabilites.

Related

Installing iOS App Directly From Safari Web UI?

I was using a website, and noticed that from my iphone on Safari, I could directly install their app from the Web UI. This was from the top of the page at https://flytap.com/ . I can't find what this is called or how to do it anywhere in the iOS documentation. This only seems to work in Safari.
Does anyone know what they are doing, or how I can do it?
This is done via adding Universal Link support (documentation here).
The banner you are seeing is the Universal Link smart banner (documentation here).
In-short, you should have a website, the website should be SSL enabled, you need to add an apple-app-site-association-file which defines the links your app needs to handle, make changes in your app to handle Universal Links and you should be good to go.
The app you shared has its apple-app-site-association file here. You can view this file for any app that supports Universal Links using the pattern https://<SITE_BASE_URL>/.well-known/apple-app-site-association or https://<SITE_BASE_URL>/apple-app-site-association.

Firebase Dynamic Links for iOS work for my device and simulators, but do not work for users after release

So I have implemented Firebase Dynamic Links in my app. I thought that I had them set up correctly, because they work for my own personal device and the simulators perfectly. I released the update to the app, but when two of my friends tried to open them after updating to the new version, it takes them to the Firebase website citing an error. I click the same link and it opens my app and handles the link.
Firebase has added the apple app site association to my domain prefix, I have added the a--link in my app's capabilities, I am truly at a loss as to why this may be. Even if they click the link from notes, it does not give them the option to open the link with my app like it will for me.
Is there anything that I could be overlooking? Happy to supply any relevant details but I feel like I have to be missing something.
App Links:
applinks:share.***.app
URL Type is set up in Target Info.
Custom Dynamic Domain is set in info.plist.
For others that come across this, it seems to be an open Apple bug: http://www.openradar.me/radar?id=4999496467480576
After several days, the user's apps downloaded the proper AASA and the deep links began to work. There doesn't seem to be a workaround with Google Dynamic Links, but Branch.io offers forced URI redirect mode to avoid this issue.

Opening file in an app from URL

I'm trying to create a link that, if clicked on a mobile device (ios), will open a PDF in a FileExplorer mobile app (or the App store if they don't have one installed). I've tried finding apps with their own URL scheme (similar to Facebook's "fb://" or YouTube's "youtube://"), but I'm not having any luck.
I've reviewed the content in the following pages and still have not found an answer:
iPhone apps: Can I open an app from a link in a website?
How to open ios app using url?
Opening an app from URL schema
There is the option to open the Files app at a specific location using the shareddocuments:// URL scheme, as described in this article.
There's no direct solution. Your best best is to let the user decide what to do with the PDF. Use a UIActivityViewController setup with the PDF. Then the user can choose. Typical options will be email, print, iBooks, Preview, other apps that handle PDFs, and as of iOS 11, the standard Files app.
You are not going to find URL schemes for "file explorer" apps in general. And there's little point to finding URL schemes to a few specific such apps. Any such apps the user may already have should appear in the activity view.

How to make google links (or any other links) to open our app?

I am developing a mapping application and I want that whenever a user clicks a google map's link or any other links (except a link from my own domain), it should show an option to open in my app as well.
How this can be achieved using Associated Domains?
If I'm -hopefully- not mistaking, what are you looking is Universal Links:
When you support universal links, iOS users can tap a link to your
website and get seamlessly redirected to your installed app without
going through Safari.
Remark: for supporting universal links, you have to have a paid Apple developer account.
Turning on the Associated Domains capability is one of the required steps to support the universal links into your application.
For more information, there is a good raywenderlich.com article about working with Universal Links.
Hope this helped.

Universal Links on macOS

Since iOS9, universal links work on iOS, but I am wondering if there is something like that on macOS? We have an application that is a macOS-App with a corresponding Web-App, and we would love links clicked by the user to open in the Mac-App instead of opening the browser with the target-link.
Is that anyhow possible on macOS? I just found samples for iOS, but none for macOS?!?
Supporting Universal Links on macOS requires support from both your app and your website (and macOS 10.15+).
See Apple's documentation Allowing Apps and Websites to Link to Your Content for details (the article deals with iOS, tvOS and macOS deep links), and its sub-articles Enabling Universal Links as well as Handling Universal Links.
Quick overview:
Basically, it's the same as on iOS: you need to create an apple-app-site-association file that is hosted on your server either in the root directory or in the .well-known directory (described in "Enabling Universal Links" linked above). It describes which URL paths can be passed to your app. It's important that this file is valid JSON (validate it!) and is served via HTTPS with a valid certificate and without any redirects!
You need to enable the "Associated Domains" capability in your provisioning profile. Details depend on whether Xcode manages your profiles or not. In your entitlements file (usually editable via the "Signing & Capabilities" tab of your target in Xcode) you need add the corresponding associated domain, like applinks:my.domain.example (no https:// or anything, just the raw domain name).
Then you need to implement application(_:continue:restorationHandler:) in your app delegate to handle the Universal Link.
It can be annoying to make macOS pick up the association for the first time during development. Debugging hints:
Open Console.app and filter for swcd, that's the daemon responsible for associated web credentials and Universal Links. Sometimes you see hints why it did not work (like refusing the apple-app-site-association file).
Also I had to kill the swcd daemon to make it get restarted by launchd and then pick up changes/fixes I did to the apple-app-site-association file. Both iOS and macOS should usually reload this file on "app installation"1 (haven't seen this getting specified more clearly; I guess they mean App Store installs/updates but I don't know about when this is loaded for macOS apps distributed outside the App Store).
Also, be aware that entering a Universal Link in Safari will not hand off to your app: Apple has stated in the dev forums2 that they believe if a user is already in the browser environment they want to stay there and not suddenly move to an app. Therefor, to test the Universal Link, open Notes.app, create a new note and enter/paste the Universal Link you want to test there. You can then click it and get asked whether you want to open this in your app.
1) Sorry, don't have a dev forum link where I read this.
2) Again, sorry, don't have a link right now. Saw this stated at least two times by Apple employees, both cited the Notes trick. Even though they were talking about iOS there, this behaviour is the same on macOS as well.

Resources