iOS Get list of all WiFi networks

2019-02-07 02:32发布

问题:

This is not a duplicate of the dozens of similar questions (too many to list) because I have evidence that it is possible to publish an app that displays a list of wifi networks.

So, it has been widely accepted and understood that you cannot get a list of all wifi networks without using a private api. The use of a private api will cause an app to be rejected from app store review.

However, Google did it recently in their Google Home app that was released on 10/26/2016, so it must be possible now. How?!?

Note- their App Store listing says the app supports iOS 8.0 or later. I need to further test if this functionality only exists on the iOS 10 version of the app, or if it in fact also exists on iOS 8 and 9.
(I grayed out my wifi name and mac address in the image)

I'm using Objective-C, so if you submit a solution in Swift, please submit an ObjC one too!

回答1:

This might be possible with NetworkExtension (available since iOS 8). But you need the com.apple.developer.networking.HotspotHelper-entitlement in you app to use these APIs. To get these entitlement, you have to contact Apple and describe, why you need it.

I haven't found any code examples, but maybe the documentation of NetworkExtension helps you.