Is there any reliable way to check for an active VPN connection or a connection over Personal Hotspot?
I am currently building an app that uses MultipeerConnectivity for peer-to-peer communication and from what I have learned so far MPC does not work with VPN / Personal Hotspot turned on.
To provide a first-class user experience (and tackle VPN problems in App Review) I want to check for a VPN / Personal Hotspot connection and display the user an alert encouraging him to disable the corresponding connection.
Just like AirDrop which should work quite similar to MPC.
I found this code snippet on Stackoverflow - https://stackoverflow.com/questions/34794255/ but since I do not really now anything about network interfaces in iOS I came here to seek help. :)
func isVPNConnected() -> Bool {
		let cfDict = CFNetworkCopySystemProxySettings()
		let nsDict = cfDict!.takeRetainedValue() as NSDictionary
		let keys = nsDict["__SCOPED__"] as! NSDictionary
		for key: String in keys.allKeys as! [String] {
				if (key == "tap" key == "tun" key == "ppp" key == "ipsec" key == "ipsec0") {
						return true
				}
		}
		return false
}
Post
Replies
Boosts
Views
Activity
Would it be possible to animate a change of the isEnabled property of SKLightNode?
I am explicitly aiming for a fade in / out animation.
Since there a lot of old questions regarding MultipeerConnectivty on this forum, and many of them not answered or solved, I thought it would be good to open this new thread and solve them once and for all.
So here are the questions:
Does MultipeerConnectivity work over Bluetooth?
Does MultipeerConnectivity work with VPN turned on?
Does MultipeerConnectivity work with Personal Hotspot turned on?