views:

4916

answers:

3

I am new to iPhone development, so I'm sorry if this is a stupid question. I am developing an application whose purpose will be to route all iPhone activity through my company's proxy.

Is there a way to programmatically set system-wide proxy settings in the iPhone (which will also take effect on the 3G connection)?

I know there is a way to manually set proxy settings for each wifi connection. Detecting new networks and setting the proxy on them would be acceptable. However, I need to also be able to set the proxy on the 3G connection.

Also, bonus: Is there a way to programmatically change the "Restrictions" settings?

If anyone has any tips or can point me in the right direction, I would appreciate it. Thanks.

EDIT: Please understand that this is for a legitimate purpose. Apple has to approve app store additions, so it's not like I'm trying to spread a virus. Please, constructive answers only.

A: 

Pretty sure this is outside the Apple provided SDK sandbox. Probably possible with a jailbreak though.

Squeegy
Wouldn't that mean that every iPhone I want to install it on will have be jail-broken? Forgive me if it's a noob question. I've learned everything I know about the iPhone in the past few days.
Andrew
+3  A: 

If you're configuring iPhones in a commercial environment, you should look at the Enterprise Deployment Guide. Specifically, you should look at using the iPhone Configuration Utility to create a *.mobileconfig configuration file that can be distributed to all the phones in your network. The *.mobileconfig plist supports changing the following proxy configuration settings on the phone:

PropNetProxiesHTTPEnable (Integer, 1 = Proxy enabled)
PropNetProxiesHTTPProxy (String, Proxy server address)
PropNetProxiesHTTPPort (Integer, Proxy port number)
HTTPProxyUsername (String, optional username)
HTTPProxyPassword (String, optional password)
PropNetProxiesProxyAutoConfigEnable (Integer, 1 = Auto proxy enabled)
PropNetProxiesProxyAutoConfigURLString (String, URL that points to a PAC file where the configuration information is stored)

The iPhone Configuration Utility does not currently support adding or editing those settings, so you may need to get your hands dirty with the Property List Editor application. Also, it looks like the latest version of the Enterprise Deployment Guide does not include the settings I've included above, but you should be able to find it in the previous version of the document.

Nathan de Vries
That looks really promising. I'm going to check it out. Thanks!
Andrew
Ok. I've read through most of that manual and tried out the iPhone Configuration Utility. The only place I see for Proxy settings is under Access Point settings, which means I can setup the proxy for any wifi networks I add in there, but I want system-wide proxy - applying to all wifi connections and the 3G connection.I didn't see a place for the settings you listed either. What am I missing? Is there a full documentation somewhere about all of the options available in the .mobileconfig file and detailing its format?
Andrew
My answer has been updated to incorporate some of your concerns.
Nathan de Vries
Great. I still can't be sure if this works the way I want it to, but I'll let you know.
Andrew
Ok. I've added proxy settings as per the previous version of the Enterprise Deployment Guide, but they're not working. The profile installs just fine, but the proxy isn't there. It's possible my .mobileconfig file isn't properly formatted, but it seems to be correct. The documentation was pretty vague about where the settings went. I can post my .mobileconfig file if you want to look at it.
Andrew
I don't really have time to debug your *.mobileconfig file. For enterprise support, your best bet is to call an Apple Expert. Otherwise, there are a few discussions on mailing lists and forums about getting proxies to work. This one looks promising:http://discussions.apple.com/message.jspa?messageID=7607519#7607519
Nathan de Vries
Thank you very much for your help!
Andrew
A: 

i've tried ti put this code into the *.mobileconfig but when added as provisioning profile by iphone configuration utility (vers. 2.2) it respond an error occur debug or close. Can u post all the code to configure a proxy server with user and password reachable by gprs/edge ? thanks a lot

Alex

alex
This does not answer the question. Please post it as a separate question.
Peter Hosey