"A server with the specified hostname could not be found."

Hey,

I have a Question: I’m trying to build a MacOS Application with Swift, where I fetch Data from Uniswap (a DeFi Exchange) via this URL: https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2. It gives me this error: “A server with the specified hostname could not be found.”. I was following the Apollo documentation on how to setup a query with swift: 3. Execute your first query - Client (iOS) - Apollo GraphQL Docs.

Does anyone know why it can’t find the subgraph URL? Thanks!

I have the same issue.
My code is known to work in iOS.

Is it possible that Apollo is not supported on MacOS?

Apollo is definitely supported on macOS, we have a whole suite of tests that run against it (and it’s actually where I do most dev since it’s way faster to test than to wait for the iOS sim to spin up).

The error “A server with the specified hostname could not be found.” is generally coming from the URLSession loading system - a quick google turns up this Stack Overflow post indicating that you need to make sure the App Sandbox is turned on (with permissions for incoming and outgoing networking turned on within that) for your macOS app for networking to work correctly.

Let us know if that works!

Thank you!
That absolutely did the trick!

To anybody else who end up here. If your app is setup to run in a sandbox environment (which it should), you have to enable access from the sandbox to any resources it needs to run, including the network.

Select your application → Signing & Capabilities → App Sandbox → Network → select: Outgoing connection (client)