Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we test iOS Universal Links / Deep Links without apple-app-site-association (AASA)?

I have implemented universal links into my app but for reason, AASA file is not going to be uploaded on server for now.

like image 552
Bharat Dodeja Avatar asked Nov 09 '17 07:11

Bharat Dodeja


People also ask

Can we test universal links in iOS simulator?

TEST THE UNIVERSAL LINKSRun the application on the simulator once to make sure the application is installed and running fine. 2. Keep the same simulator launched and running. Go to your simulator browser and open type the ngrok domain address i.e., https://1bd39880fbad.ngrok.io in my case.

How do I enable universal links in iOS?

How do I set up Universal Links for my app? Log into your Apple developer account and go to the app's ID page. Enable the Associated Domains app service. Take note of your Prefix (bundle ID) and your ID (team ID) - you will need them later.

What is an AASA Apple App site Association file?

When a user on an iOS device running iOS 9 or later clicks on a link, the device checks whether that link should be handled by an app instead of being passed off to Safari.

How do I deep link in iOS?

First, open Xcode, go to Project settings -> capabilities. Scroll down to Associated Domains and turn it on. Once it is enabled, we shall add any URL that implements our apple-app-site-association resource, preceded by app links. Inside the Domains section, add a applinks:myApp.com.


1 Answers

Yes you actually can!

You can test you app's response to a deep link without actually implementing the remote side by calling this function from terminal:

$ xcrun simctl openurl booted 'YOUR_LINK_HERE'

This will trigger the following callback in your app's appDelegate:

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool

...which is exactly the behavior you should expect from a deep link.

just don't forget to actually have the simulator up ;-)

As for universal links - the appDelegate callback is slightly different, but its a very small mental leap:

func application(_ app: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
    if userActivity.activityType == NSUserActivityTypeBrowsingWeb {
        if let url = userActivity.webpageURL {
            // parse the url and decide how to handle the universal link

        }
    }
    return true
}
like image 121
Noam Avatar answered Nov 04 '22 04:11

Noam