I found the issue. Just for reference, the way I found out was to use the Console.app and filter on my app process, and I saw this message when the client was trying to connect:
“Operation not permitted” on com.apple.network
So I went back to XCode, and checked the app project settings and I found out under “Signing & Capabilities” → “App Sandbox” → Network → “Incoming/Outgoing connections” was actually ON for Debug and Test, but OFF for Shipping. No idea why that is the default, so I just turned it on also for Shipping and it worked.