Question: I am working with VPN on iOS using the NetworkExtension framework. I am able to install the config and make connection. My question is if there's a way to detect if the VPN config is still installed or detect if user has un-installed the config? 

I am not necessarily looking for a notification or anything in the background but what I am looking for is some method/workaround that I do when the application is brought to foreground?

I'm using certificate authentication with a certificate issued by an intermediate CA and have tried 'evaluating trust' method from here: [Check if a configuration profile is installed on iOS](http://blog.markhorgan.com/?p=701)

This did not work for me. I always comes to be trusted. I have also tried this:

```
if([NEVPNManager sharedManager].protocol){
   //installed
}else{
   //not installed
}

```

But this also does not work. After uninstallation the protocol remains valid. If I quit and relaunch the app then the protocol is invalid.

Any suggestions are appreciated.

Answer: 
You can try following

```
if ([[[NEVPNManager sharedManager] connection] status] == NEVPNStatusInvalid) {
    //...
}

```
Might be a little late. But i've encountered the same problem. However, your approach got me in the right direction. You should load it within the completion handler of: `loadFromPreferencesWithCompletionHandler`

The propper use, in my opinion, of checking if there is a profile installed:

```
   manager = [NEVPNManager sharedManager];

   [manager loadFromPreferencesWithCompletionHandler:^(NSError *error) {
       if (manager.protocol == nil) {
           NSLog(@"Profile is not installed, you might want to install a profile");
       } else {
           NSLog(@"Profile is installed. It looks like this: %@",manager.protocol);
       }
   }];

```