world
world

Reputation: 3952

How do I get universal links working via XCUI in the iOS Simulator?

We have an app that allows for it to launched via a universal link. It works perfectly. Now, we want XCUI test coverage in the iOS simulator so we can save devs the time required to have 10 different iOS devices on hand at all times.

As such, we wrote some XCUI tests. All of them pass with one painfully notable exception. Launching the app via universal link to the iOS simulator fails (it just shows the Safari redirect instead of the app being launched). However, when an apple device is connected to Xcode, the test passes every time.

Has anyone gotten this to work on the simulator?

FYI, our AppDelegate is in swift and we are using this delegate for the universal link:

func application(application: UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: ([AnyObject]?) -> Void) -> Bool {` 

Upvotes: 3

Views: 973

Answers (1)

Roland
Roland

Reputation: 489

Quite late to the party, but it might help others that search for the same thing I did.

You can not use Universal Links on the simulator:

https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html#//apple_ref/doc/uid/TP40016308-CH12-SW2

You can test universal links on a device.

Edit, 09.2019: Universal Links now work on the simulator. They still need to be "tapped" (Contacts, Mail, Notes, etc), so you can't test them programatically.

Upvotes: 1

Related Questions