Search code examples
objective-cmacosvpn

Get notified of VPN state change in OS X 10.11 and above


I have an app that uses a VPN. I can programmatically connect and disconnect from the VPN just fine and update the app's UI accordingly. I've recently noticed that the state of the VPN can change outside of my apps control and my app isn't notified of the state change and thus can't change the state of the UI to reflect the change. This leads to my app's UI being out of sync with the true state of the VPN. Is there a way my app can get notified of the state change?


Solution

  • NEVPNStatusDidChangeNotification is posted when the status of the VPN connection changes.