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

2

6

When an iOS Device goes into "sleep mode", even a configured VPN is, unfortunately, turned off.

A customer that wants an app for his iPad has to use VPN for security, so anything must be done through VPN. The app has to synchronize a lot, but the iOS device might turn off the VPN by itself. That's why I just need to trigger it again every time i need an internet connection (or keep it alive).

Do any of you guys have anything in mind?

Even using Private API is ok (the app will only be distributed to a customer, not through App Store).

Or using any app like Cisco AnyConnect would do the job.

Militiaman answered 18/2, 2013 at 16:23 Comment(2)
Take a look at the answers to this similar question. Also try searching some more with the phrase "keep alive". That's the usual term to describe that you don't want a connection to be closed, which is one way to solve this problem.Outdoors
Have you found a solution finally? I also need to check or to turn VPN on within our corporate app (that won't be deployed through App Store too) #18672395Marroquin
B
7

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.

Barytes answered 19/2, 2013 at 1:11 Comment(0)
B
0

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

Busyness answered 28/7, 2015 at 11:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.