A call to NETunnelProviderManager -startVPNTunnelWithOptions:andReturnError: when in airplane mode or all interfaces are disabled will return without an error, but the tunnel isn't started. In the console it's clear what the problem is:
default | 14:39:25.852701 -0700 | nesessionmanager | -[NESMSession handleCommand:fr:393 NESMVPNSession[...]: Received a start command from appname[512] |
default | 14:39:25.865293 -0700 | nesessionmanager | -[NESMSession setStatus:]:755 NESMVPNSession[...]: status changed to connecting |
error | 14:39:25.867015 -0700 | nesessionmanager | -[NESMSession handleNetworkPre:638 NESMVPNSession[...]: No network available |
default | 14:39:25.870846 -0700 | nesessionmanager | -[NESMSession setStatus:]:755 NESMVPNSession[...]: status changed to disconnecting |
default | 14:39:25.876285 -0700 | nesessionmanager | -[NESMSession setStatus:]:753 NESMVPNSession[...]: status changed to disconnected, last stop reason No network available |
Is there a way to programmatically get hold of this error so I can let the user know? Currently we're doing preflight checks to try to avoid this situation, but there's the occasional corner case where this gets through, and we don't have a way to detect it. I'm not sure how easy it is for Apple to propagate errors back from NESMSession to NEVPNManager.
thanks,
Eric