32

I've heard that iOS 5 introduced a feature in which the iOS device can share its wifi configuration with a docked accessory via the ExternalAccessory framework. The trouble is that I can't find any specific details on implementing this type of scheme in the SDK docs.

From my research, I've begun to suspect it's achieved via the 'iPhone Configuration Utility' but this still seems like a bit of a messy method to implement on a device.

Anyone got any ideas?

Once the wifi setup data is available, it should be easy enough to package it up and send it out via the ExternalAccessory framework to the device, where I'll build in protocol support accordingly.

Thanks

njt
  • 511
  • 4
  • 12
  • 1
    I'm now leaning towards the CNCopyCurrentNetworkInfo function in the CaptiveNetwork interface. – njt Jan 12 '12 at 10:00
  • [CaptiveNetwork](http://developer.apple.com/library/ios/#documentation/SystemConfiguration/Reference/CaptiveNetworkRef/Reference/reference.html) reference – njt Jan 12 '12 at 10:01
  • hmm yeah. i had a dig around the docs, seems like CNCopy.. just spits out a hashed version of the ssid/key etc. so kindof pointless in my application. – njt Feb 12 '12 at 11:50
  • 2
    i've found a hardware dependent way of doing this, but it too seems like magic. think it's specific to Apple/hardware vendor, not a publicly accessible method. – njt Feb 12 '12 at 11:51
  • @njt What is the hardware dependent method you mentioned? – james_womack Feb 14 '12 at 19:09
  • 4
    Using a dedicated airplay streamer module, not quite sure how the magic works. any more info would be NDA infringing... sorry – njt Feb 14 '12 at 23:19
  • 3
    True, this part is under MFi NDA – Rok Jarc Feb 22 '12 at 16:03
  • 1
    The only way you'll find reliable information on it is applying to the MFi program. It's not easy to get into this program. – ppaulojr Mar 04 '12 at 01:02
  • i'm already an MFi developer with 2 iPod dock systems on the market.. couldn't find anything easily on there, but it's been sorted now. thanks for your recommendations! – njt Mar 04 '12 at 09:28
  • http://stackoverflow.com/questions/5867650/looking-for-resource-to-learn-externalaccessory-framework-ios check this link – Ramz Mar 05 '12 at 09:30

5 Answers5

11

Yes! you certainly can. However, to use HomeKit (the library you need) you first need to be a certified MFi (Made For iDevice-iPhone-iPod-iPad) developer. This gives you the ability to allow a user to view all available wifi networks and choose to link the device.

One example of this is Withings with their Aura sleep aid. See screenshot from on boarding experience:

enter image description here

Then the user can then choose to share their home wifi information securely with the new device.

enter image description here

Ethan Parker
  • 2,986
  • 1
  • 23
  • 29
  • The bad news is that getting approved is a bit of a process. It'll take a lot of effort for a small company but is for sure worth it to the end user. Gives a more professional, seamless setup process - pretty much same one you'll use when you set up your Gen 4 AppleTV! – Ethan Parker Jan 10 '17 at 23:04
2

The user-visible UI looks like this:

enter image description here http://www.theregister.co.uk/2012/07/12/pure_contour_200i_air_airplay_wireless_music_system/

enter image description here https://withings.zendesk.com/hc/en-us/articles/201488707-Wi-Fi-Setup-of-the-Wireless-Scale-WS-30

jrc
  • 20,354
  • 10
  • 69
  • 64
  • Hi, I Have registered for the MFI program and now I am trying to read the wifi networks. But since I have not used the home kit earlier, I have not getting how to read the wifi networks. Is there any tutorial or samples available to achieve the same. Please share it – shasha Oct 29 '15 at 08:56
2

A bit late but configureAccessory is the method (part of ExternalAccessory) introduced in iOS 8.0 that you can use to configure a wifi accessory:

https://developer.apple.com/documentation/externalaccessory/eawifiunconfiguredaccessorybrowser/1613907-configureaccessory

It's part of the EAWiFiUnconfiguredAccessoryBrowser class:

https://developer.apple.com/documentation/externalaccessory/eawifiunconfiguredaccessorybrowser

And showBluetoothAccessoryPicker is the one for Bluetooth products:

https://developer.apple.com/documentation/externalaccessory/eaaccessorymanager/1613913-showbluetoothaccessorypicker

which is part of the EAAccessoryManager class:

https://developer.apple.com/documentation/externalaccessory/eaaccessorymanager

Alfred
  • 7,071
  • 4
  • 27
  • 35
1

I doubt Apple would ever allow for an average developer to access private data such as wifi connections settings. Maybe trusted third party accessory provider yes, but you probably no.

Wifi settings are private and contain passwords. An average (non-power) user uses more or less the same/similar password for everything including their Wifi network. If an app can easily read that it could be badly exploited.

The same way you cannot get the Apple id let alone the password.

Tibidabo
  • 21,461
  • 5
  • 90
  • 86
  • 4
    It does exist in iOS 5. I've never wanted to actually read the data, just pass it over to the host MCU. This is now working in my product. – njt Mar 16 '12 at 09:42
  • I just started looking into the same thing for a product, I am running into the same issues you had it seems. Are you able to provide any pointers? – Greg Price Apr 17 '12 at 18:24
  • Not without breaking 2 NDAs I'm afraid. If you're MFi licensed then you should be able to find this out. – njt Jul 04 '12 at 12:48
1

Have you seen this: iPhone get SSID without private library

Is prompting the App user for a secured network password out of the question?

You can at least get the SSID of an unsecured network and pass it to your accessory with a getter something like:

#import <SystemConfiguration/CaptiveNetwork.h>


@implementation DeviceWifiSSID

//https://stackoverflow.com/a/5198968/614688
+(NSString *)deviceSSID
{
    NSArray *ifs = (__bridge id)CNCopySupportedInterfaces();


    id info = nil;
    for (NSString *ifnam in ifs) {
        info = (__bridge id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);

        if ([info objectForKey:@"SSID"] != nil)
        {
            return [info objectForKey:@"SSID"];
        }
    }


    return nil;
}

@end
Community
  • 1
  • 1
ultramiraculous
  • 1,062
  • 14
  • 21