I am creating an app for iOS that uses the internal resources of a network. I would like to have the app automatically turn on the VPN connection within Network Settings if the device isn't already connected to the wireless. I have already done the coding to find if its on the wireless or not. What would be the code (if any) to turn on VPN within an app?
you wouldn't need any code for this. you would use the Apple iPhone configuration utility to configure an "on demand" VPN for a given domain. Apple has a guide that should explain how to configure the profile.