How to trigger PER-APP-VPN using NEVPNManager class in iOS using Swift4

Viewed 182

I need your some efforts, for helping me to resolve this PER-APP-VPN issue.

Problem Statement : My app is unable to invoke PER-APP-VPN, while opening app.

Description : I've deployed my app on MDM i.e supervised device. Whenever I open my app, it doesn't trigger PER-APP-VPN connection automatically.

What did I tried: For this I've written below code...this is just I've done for demo purpose. But still not working.

            let status=NEVPNManager.shared().connection.status
            print(status)
        }

        let manager = NEVPNManager.shared()
        let result = NEOnDemandRuleConnect()
        result.interfaceTypeMatch = .any
        manager.onDemandRules = [result]
        manager.isOnDemandEnabled = true
        manager.isEnabled = true
        manager.saveToPreferences()
        self.vpnStatus.text = manager.connection.status.rawValue == 1 ? "VPN Connected" : "VPN Not Connected" 

Scenario: I've corporate VPN. And I'm deploying app on corporate / work supervised device. I've deployed app on Blackberry EMM Solution.

So, I've assigned PER-APP-VPN profile. But still it is not invoking VPN connection automatically.

0 Answers
Related