5

I am using MicroExpress to create a web server in a SwiftUI app. I can connect to the server when I am running the app in Simulator, but I cannot make it work on my real device.

MicroExpress (based on SwiftNIO) creates a Webserver on the iPhone and shall expose an API in the local network.

I think I need to add a capability or something, but I cannot find the network capability nor a setting to allow incoming network connections in Xcode 11 under Signing & Capabilities.

How do I make the app allow incoming network connections?

EDIT

I have already added Allow Arbitrary Loads to allow HTTP if that is necessary. I am connecting over HTTP at the moment.

TheTiger
  • 13,264
  • 3
  • 57
  • 82
  • Are you connecting to your server over HTTPS? If not, you need to add an exception to TLS (but don't, use a https server) – Oscar Apeland Nov 25 '19 at 11:39
  • I did add "Allow Arbitrary Loads" to allow HTTP if that was / is necessary. I am connecting over HTTP at the moment –  Nov 25 '19 at 11:43
  • Then it should work. There's no additional entitlement required for network activity – Oscar Apeland Nov 25 '19 at 11:47
  • Also for incoming network requests? Which domain do I need to add since the iPhone acts as a server? –  Nov 25 '19 at 11:48
  • I don't really know about that :/ If you're working over HTTP it might be disallowed entirely, Apple really doesn't like nonsecure loads. Again, dont know. – Oscar Apeland Nov 25 '19 at 11:49
  • This is about incoming I/O processed by NIO directly, which is unrelated to ATS. – hnh Nov 25 '19 at 11:59
  • Are you connecting to the right IP address for the device on your local network? – Paulw11 Nov 25 '19 at 12:07
  • Yes I am pretty sure! Correct port and correct IP address :) I use LAN Scan by https://debookee.com –  Nov 25 '19 at 12:09

1 Answers1

4

I looked at the tutorial and I think you need to bind to 0.0.0.0 instead of localhost. Doesn't have to do with capabilities nor ATS.

Unpunny
  • 162
  • 3