I am working on an iOS app that is configured to work with Pulse Secure VPN. I have subscribed to the reachability change notification to log network down scenarios. The below code in AppDelegate.m is working fine as it is. If per app VPN is enabled, it does not recognize network change(LTE to Airplane Mode and vice versa).
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.reachability = [Reachability reachabilityForInternetConnection];
[self.reachability startNotifier];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityChanged:) name:kReachabilityChangedNotification object:nil];
}
- (void) reachabilityChanged:(NSNotification *)note
{
Reachability* curReach = [note object];
NetworkStatus netStatus = [reachability currentReachabilityStatus];
switch (netStatus)
{
case NotReachable:
{
break;
}
case ReachableViaWWAN:
{
break;
}
case ReachableViaWiFi:
{
break;
}
}
}
It would be helpful to know if I need to do extra configuration for VPN enabled app. I cannot use reachabilityWithHostName:
since the app connects to various domains.