2

I'm trying too get a universal link working in the simulator so I can test it out. As this is a work project I don't have a compatible device I can use. Thus trying to make this work on a simulator.

I've done everything I can find on the web to try and make this work:

  1. Added the associated domains to the app and set the domain as applinks:192.168.50.200?mode=developer. I'm using the web server on my Synology NAS to test this out.
  2. Added the application(_:continue:restorationHandler:) method to the app delegate, logged the incoming URL and returned true.
  3. Created a .well-known/apple-app-site-association file in the NAS's web server.
  4. Tried using simctl, iMessage and Safari to open a matching URL that should then open in the app.

But step 4 doesn't work. Instead the simulator just opens the URL as a web page.

I've installed proxyman and it shows the web page URL being sent to the server and the response coming back, but at no time is a request sent from the simulator for the apple-app-site-association file. No matter how I try and invoke things.

A number of blogs I've read say that you should be able to test universal links in the simulator using a number of the techniques I've tried. But they don't work for me. I've tried this on an iOS 11.4 and a 13 simulator.

Any ideas? I'm fresh out.

drekka
  • 20,957
  • 14
  • 79
  • 135
  • I know nothing about Synology, but I would suggest using a real (remote) web server. I know that _that_ works. – matt Aug 27 '20 at 20:30
  • Check this thread: https://stackoverflow.com/questions/32751225/ios-universal-links-are-not-opening-in-app/66353132#66353132 In simulator its not working but on device working perfectly. – Sagar Sukode Feb 24 '21 at 14:45

2 Answers2

0

I've since found data in the console. I'm seeing

Task <377F99B3-B58C-4D9B-BCC2-FE36E4D9569B>.<2> finished with error [-999] Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://192.168.50.200/.well-known/apple-app-site-association, NSErrorFailingURLKey=https://192.168.50.200/.well-known/apple-app-site-association, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <377F99B3-B58C-4D9B-BCC2-FE36E4D9569B>.<2>" ), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <377F99B3-B58C-4D9B-BCC2-FE36E4D9569B>.<2>, NSLocalizedDescription=cancelled}

so it looks like it is calling the server, but there is nothing indicating why the request is being cancelled.

drekka
  • 20,957
  • 14
  • 79
  • 135
  • This indicates that the connection was cancelled by the operating system due to a TLS certification issue. See [ATS](https://developer.apple.com/documentation/security/preventing_insecure_network_connections) for details. It's a common pitfall when debugging secured network traffic with a MITM proxy. – mbi Nov 25 '20 at 08:25
0

Figured it out. It was because my NAS server's web server didn't have a valid cert that would satisfy Apple's TLS. For testing purposes I ended up using ngrok to provide a valid cert and redirect into my NAS. It's a bit of a pain because every time you start then grok tunnel it generates a random but unique domain, but for testing purposes it works perfectly.

drekka
  • 20,957
  • 14
  • 79
  • 135