6

My company is developing an iPhone accessory that requires a relatively high connectivity rate to the phone. Due to MFi limitations (USB 2 communications in HOST mode fair only around 100KBps), we're looking at hosting a WiFi ad-hoc network on our accessory, and connecting to that network with the iPhone's WiFi.

This could really work out great in many regards, except we can't seem to find an (Apple-approved) way to programmatically switch the iPhone's WiFi connectivity. Ideally the app would automatically connect to the accessory's network when visible, and then re-connect to the user's preferred network when not visible/needed.

We are aware of the MobileWiFi framework, which fits the technical bill, but won't pass Apple's approval process.

Can anybody suggest a way to achieve our goal? Perhaps there is a system model view that can be called up to allow the user to switch WiFi networks without directly using private APIs?

Creative solutions welcome!

kapa
  • 77,694
  • 21
  • 158
  • 175
mdavis
  • 191
  • 3
  • 7
  • 1
    Have you done any testing that proves that you were only getting 100KBps using USB Host mode with MFi. I am up against a similar issue but have heard that you can get ~500KBps (anecdotal evidence only) – OneGuyInDc Nov 20 '12 at 13:09

2 Answers2

7

Hate to say it, there's really no way to do it. I can think of two easy workarounds.

1. Make it available on Cydia for jailbroken devices. AirServer just did this.

2. Less elegant, have UIAlertView with a switch over to the wifi pane of the Settings app that is shown when the peripheral is connected and disconnected. A lot like the location settings prompt.

3. Make an Android app!

Apple, you're a pain in the ass.

Community
  • 1
  • 1
Peter Kazazes
  • 3,600
  • 7
  • 31
  • 60
  • Thanks for the reply. Option #2 is something we have considered. Is there a way to switch directly to the WiFi settings section of the Settings app specifically? – mdavis Aug 08 '11 at 23:17
  • I'm afraid answer to that is no too. – Filip Radelic Aug 08 '11 at 23:22
  • 3
    as of iOS 5.0, you can use the following to auto-navigate to the WIFI Settings: [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]]; (many other prefs are available apart from WIFI). – paiego Mar 06 '12 at 06:16
  • 1
    I know this question/answer is old, but for the sake of others searching for this as I was, the URL seems to have changed for iOS 8 and later. Now you would use `UIApplication.sharedApplication().openURL(string: UIApplicationOpenSettingsURLString);`. It doesn't seem like you can go directly to a specific settings page anymore. – c1moore Oct 07 '15 at 01:50
3

Sorry to be the bearer of bad news, but the definite answer is no. The main problem with your approach wouldn't even be Apple's approval process, but the inability to access the Internet while connected to your device. iPhone doesn't even try using cellular data when connected to wifi, being that wifi connected to the Internet or not.

You could file a bug report requesting these features and pray Apple hears you which will probably never happen in this case.

I would suggest going bluetooth, but if usb is not fast enough for you, guess that's not an option either.

That pretty much puts you back to square one and going usb. Or distributing your app via Cydia.

jbat100
  • 16,757
  • 4
  • 45
  • 70
Filip Radelic
  • 26,607
  • 8
  • 71
  • 97
  • Thanks for the answer, fichek. It's too bad Apple doesn't allow at least the ability to present a system dialog for this. -- but FYI, we did some testing regarding cell connectivity when on a "dead" (no outside access) WiFi network and it worked just fine! // do you by chance have any real-world data about bluetooth transfer rates? Thanks! – mdavis Aug 08 '11 at 23:06
  • Really? I never tested it thorougly, but whenever my adsl dies (and that used to happen *very* often), I can't access anything untill I kill the wifi or adsl comes back up. Sorry I couldn't be more helpful. – Filip Radelic Aug 08 '11 at 23:12
  • I've heard that same, but in my testing it worked fine! (Connected iPhone WiFi to a non-routed Ad-Hoc WiFi network -- 3G worked fine!) I'll have to try this again. That would definitely be a deal breaker. – mdavis Aug 08 '11 at 23:16
  • It's possible that it just doesn't switch back to cellular automatically when wifi's connectivity breaks, but stays on cellular if there is no connectivity in the first place. – Filip Radelic Aug 08 '11 at 23:21
  • Actually I believe it's because ad-hoc networks by definition aren't connected to the internet like a true access point (called infrastructure mode), so the iPhone continues to use cellular for internet connectivity when attached to an ad-hoc network. – Larry S Apr 05 '13 at 00:29
  • @LarryS there have been some changes in iOS 6, so this question/answer are no longer relevant really. – Filip Radelic Apr 05 '13 at 06:59
  • @FilipR Thanks for the update. Does iOS 6 let you programmatically select WiFi networks? That would be very useful for us. – Larry S Apr 06 '13 at 21:04
  • @LarryS unfortunately no, but it will automatically use cellular data if there is no Internet connection via WiFi. – Filip Radelic Apr 06 '13 at 21:10