get current WiFi ssid

With iOS 9 beta 4, the CNCopySupportedInterfaces API is broken.

(it was working until beta3)

So my app can't get current wifi ssid.


It should be possible to use [NEHotspotHelper supportedNetworkInterfaces]

However it returns always nil.


How is it possible to get current ssid ?

(I don't want to manage hotspot network)

Accepted Reply

Looks like it works again in iOS 9 GM

Indeed.

I also want to draw your attention to the big **** comment at the top of

<SystemConfiguration/CaptiveNetwork.h>
in the iOS 9 SDK included with the Xcode 7.0 GM seed. To wit:

IMPORTANT This API is deprecated starting in iOS 9. For captive network applications, this has been completely replaced by

<NetworkExtension/NEHotspotHelper.h>
. For other applications, there is no direct replacement. Please file a bug describing your use of this API so that we can consider your requirements as this situation evolves.

If you do file a bug about this please send me, via email, your bug number. My email address is in my signature, below. For the next month or so I’m going to collect input on this issue.

You should, of course, feel free to continue discussing the issue here on DevForums.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

Here is the reason they gave for not approving my request.


"We’re writing to inform you that we’re not able to approve your request. Use of the NEHotspotHelper API is not intended for the use you’re requesting."

Turbo, in my experience, I have found that it is useful to pick up the phone and speak with someone at Apple. If nothing else, you might get some advice allowing you to adapt your app so that it does conform?

eskimo,

Thanks for taking the lead on this issue.


My app communicates with the Nissan Leaf electric vehicle by using a WiFi OBDII adapter plugged into the Leaf's OBDII port. This makes a local "hotspot" that my app can communicate with after the user has selected the OBDII WiFi network.


The first thing a user of my app does after install is to register the WiFi OBDII adatper's SSID with the app. The user starts my app and confirms on a settings screen that the current WiFi SSID is the WiFi OBDII adapter's SSID. Now my app knows (but not in iOS 9!) by reading the current WiFi SSID if the iOS device is connected to the Leaf. If it is my app will start collecting data to display to the user. If the SSID is not the registered one then my app goes into an offline mode and just lets the user review previously saved data. If will also disable running in the background if the SSID does not match. While in offline mode the app polls the current SSID to see if it ever matches the registered one. If it does match, a connection is established and data is collected.


The temporary fix I am looking at, which I don't think is very good, is to just assume that the current WiFi SSID is always the OBDII adapter's SSID. This is ok if the WiFi network is actually the OBDII adapter network. But in the case that it is not ,the app will try to communicate with whatever network is selected or even when none is selected. It will do this over and over again wasting power in a futile attempt to communicate with the Leaf.


My app can also run in the background and the app uses the current SSID to know when the user has moved out of range of the WiFi OBDII adapter in which case it will stop running in the background. This will not happen with this fix and if the user does not go into the app settings and disable background operation the battery will be drained unnecessarily making for an unhappy customer when their battery goes dead.


To me readng the current WiFi SSID is no different then reading the screen size or iOS version number. It tells the app critical information about the environment.


It appears your developers think the WiFi network is only used to connect to the internet so no one should care about the SSID. That is not the case.

I'd like to add another point to the discussion.


We're using the current SSID to display it to the user in case of an error (the "device not found" kind of error). This has saved hundreds of frustrating debugging hours for our users, because you just *see* in the error message, that you're not connected to the WiFi-AP, that you think you are. "Ah, of course I'm unable to find the device on my home network, my iPhone is still connected to my neighbors AP". Or the restricted guest WiFi, or your colleagues AP in the office, or the open AP of the pub downstairs, you name it ...


You're about to remove a really helpful feature.


Thanks for having a second look on the entire issue!

It appears that a lot of users use the CaptiveNetwork functionality for retrieving information about the current WiFi network. I am one of those developers.


My app displays the network name / SSID to the user after a task has completed. While the current version doesn't really require the network name in order to function, an upcoming update including new features does. The update is already in the testing-phase, but it appears that we're going to have to push the update further away due to the deprecated functionality. 😟


I have requested the NEHotspotHelper entitlements, but I'm still waiting on a positive reply.

Apple, I really hope that you understand how many developers need to be able to retrieve the current WiFi network information for their app to be functional.


I really hope that in the next iOS9 beta the deprecated functionality will be re-introduced. A new simplified API that allows us to get the information we need would work too.

I did not mention it but my app also displays for a few seconds the current WiFi SSID on startup. I can not count the number of times I have gotten in my Leaf, started the app and found I am still connected to my home network not the Leaf OBDII WiFi network. I am sure all my users have done the same and without seeing the message about the current SSID they would not be prompted to go back and select the OBDII WiFi network. Of course if they were just reviewing data in their house they would know to ignor the incorrect network messages that flashes up.

So how can we get this changed so we can still get the current WIFI network name? For those apps that use it, it's an extremely useful feature and for some of us it's necessary. I've already filed a bug report, but I have doubts it will get looked at for a few years like all the other bugs.

eskimo --


I'll file a radar for this too, but I wanted to share my use for CaptiveNetwork: We have a custom device that acts as a WiFi Access Point and we're using the first 24 bits of the BSSID (Organization Unique Identifier) as a verification check that the user is connected to an expected WiFi network. It allows us to be more specific in suggesting trouble-shooting steps (i.e. "Please check that you're connected to the correct WiFi network") rather than just reporting a generic TCP-level connection failure. For our case, even if the user had to confirm they wanted to share that info, that would work with our flow and still provide value.

I also got my request of Hotspot helper entitlement rejected with the reason:

"We’re writing to inform you that we’re not able to approve your request. Use of the NEHotspotHelper API is not intended for the use you’re requesting."


I use SSID for my app to identify:

  • whether the user is connecting into his local network or over cloud.
  • My app talks to a hardware which has some features restricted depending on local or cloud connection.
  • And if I know the SSID I can directly connect to the hardware. Otherwise first I need to try connecing over the wifi and if it fails then I need to connect over cloud which causes the connection time increase if user is not there in the same network where the hardware is connected to.
  • Also at the time of some connection isues we instruct the user that 'his hardware is connected to "SSID" and the iPhone is connected to "SSID". Please make sure both iPhone and hardware in same network'.


Hi Eskimo,


This email address: - networkextension@apple.com as listed in the following document "717_whats_new_in_network_extension_and_vpn.pdf" bounces back. Has the email address changed for these requests?


CNCopySupportedInterfaces API 对于我的产品,是很重要的,如果无法获取SSID 和 BSSID, 我的App讲无法正常运行;

我们App是用于Wi-Fi智能灯泡, App会读取当前的SSID 和 BSSID判断手机是否直接连接到我们WiFI灯泡的热点, 从而提示用户不同的操作流程, 如果用户直接连接到灯泡的WiFi热点, 这样需要通过设定将WiFi灯泡连接到路由器, 如果用户连接的是家庭的WiFi网络,则进行其他的逻辑判断.

我们已经出售了几十万WiFi灯具设备了, 如果无法获取SSID 和 BSSID, 我们的App将无法使用, 会有大量客户投诉或者退货, 可能会导致我们公司破产.

请Apple认真考虑我们的问题. 不要取消CNCopySupportedInterfaces API ,我们只需要获取当前SSID 和 BSSID, 不需要NEHotspotHelper的其他功能.

You don't understand. No one here wants to turn their app into a "Hotspot helper" just so they qualify to use the NEHotspotHelper APIs. We just want to be able to read the current WiFi SSID and use that information within our current app.


A phone call is not going to help. It is very unlikely the person handling the phone would even understand the question.


Since eskimo understands our needs and has passed them along to the programming staff at Apple handling iOS that is the best way to get this resolved. We need an approved (and supported in all future iOS versions) way to read the current WiFi SSID.

Agree, we only want readonly API to get the current SSID string. For example, iOS device usually will remember several WiFi hotspots; when current WiFi is down, iOS will automatically switch to another WiFi hotspot without notifying user. If that happens to my app, it does not connect to the server any more. Then my app only can notify user that your connection to server is lost. But, user might not notice, one's iOS device is switch to another WiFi hotspot and can't connect to previous server. This is really helpful to user for trouble shooting. Can we have some simple API for get SSID. NEHotspotHelper is too much for most apps which only want to show currently SSID, but not do any heavy task.

This email address: - networkextension@apple.com as listed in the following document "717_whats_new_in_network_extension_and_vpn.pdf" bounces back. Has the email address changed for these requests?

No, the email address remains unchanged.

By an amazing coincidence I happened to email that address yesterday and it worked for me.

Finally, keep in mind that, as I mentioned in my post on 5 Aug, requesting access to NEHotspotHelper is only appropriate if you're actually developing an app to manage a captive network.

Share and Enjoy

Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

This is really bad news. 😠



I have been developing a new app in the last months and the possibility to read the current WiFi SSID is crucial for my app since it permits a feature that distinguishes it from other, more common, apps. Now it feels like I just want to throw everything in the bin and delete all code.


I truly hope Apple will understand what a mess they are creating among developers by this decision. Things are getting even worse when we are not being allowed to use the NEHotspotHelper API as an (the only available) alternative! From this thread, it seems like all requests have been turned down.


I really hope Apple reconsiders and can create an API to get WiFi SSID.