How to turn on VPN from iOS app? (Private APIs OK)

亡梦爱人 提交于 2019-11-30 09:41:00
Victor Ronin

Two ideas:

1) You can create a configuration profile with VPN on demand. This require client certificat authentication though. My guess that if some application will try to access domains or hosts defined in VPN on demand section in sleep mode, VPN will be turned on.

Update: At some moment Apple was sued regarding VPN on demand, so I believe they dropped this feature and after returned it back modified. It's good idea to read this article for iOS 7: http://support.apple.com/kb/ts4550

2) Idea which I offered for this question (iOS6 toggle WiFi on non-jailbroken device). Here is the copy of text from there:

I think it make sense to look at SystemConfiguration.framework.

It has set of API to work with different connection interfaces, which are defined here: http://developer.apple.com/library/mac/#documentation/Networking/Reference/SCNetworkConfiguration/Reference/reference.html

This one is private API.

Update: I believe there were some changes in SystemConfiguration and Apple tightened security around this framework.

3) Apple may grant to some applications additional entitlements, so they can build functionality which no other application can build. As example, VPN client companies (like Cisco) got special entitlements to build what in iOS called "VPN plugins", which is essentially VPN client.

Its now possible to do with NetworkExtension framework available in iOS 8 and up. If you go to project settings->capabilities you will find "personal VPN". By turning it on you get the framework added to your project. There is little to no official documentation, but you can check out the WWDC video here https://developer.apple.com/videos/wwdc/2015/?id=717

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!