How to display a list of Wifi-Networks in an iPhone app?

前端 未结 3 1379
庸人自扰
庸人自扰 2021-02-10 06:17

I found some private (undocumented) APIs but Apple does not allow apps to use private frameworks. So does anyone know how to do this using Apple official packages?

like:

3条回答
  •  心在旅途
    2021-02-10 07:00

    The best you can do in iOS, currently, is display the network the user is currently connected to. iOS doesn't allow you to access a wifi scan from within an app. I've been wrestling with this inability for some time now.

    If designing an accessory that has WiFi, where you're trying to pass the user's WiFi network SSID and password, it will be up to the accessory to give the app that wifi scan list. The app can then display the list the accessory gave it to the user.

    (I bet that's how the app @zaid pointed out in his answer, "iHome Connect", is doing it.)

    Another approach is you could have a screen that prompts the user to enter the password to the wifi network they're connected to already, and then once the accessory is connected to the app, pass those details without the need for a wifi network list. I think that approach has a better user experience.

    Plenty of stackoverflow questions that answer how to get the current wifi network, here's a couple:

    Getting OSX Connected Wi-Fi Network Name

    How do I get the current wifi network name after Yosemite in Swift?

提交回复
热议问题