6 Replies
      Latest reply on Aug 12, 2019 8:56 AM by reid0008
      reid0008 Level 1 Level 1 (0 points)

        Hi, I am using CNCopyCurrentNetworkInfo to get the SSID of the current wifi connection. I am wondering if there is a way to tell whether this WiFi is 2.4 or 5.0Ghz? Is there another function I could call to check this?

         

        Thank you

        • Re: Current Wifi Check for 2.4Ghz
          KMT Level 9 Level 9 (15,305 points)

          You'd need to talk to the device(s), first, and even then you risk assumptions - For example, 802.11ac devices can't connect to a Wi-Fi router in 802.11n-only mode. In other words, I don't think there is a lever you can pull via code to know for certain. Just because a device is capable, doesn't mean a specific configuration is in use/available. Same as if a network name includes 5.0 in it's name...doesn't mean you can count on that being true.

           

          Perhaps if you explained your end goal for wanting this ability, someone could offer suggestions.

            • Re: Current Wifi Check for 2.4Ghz
              reid0008 Level 1 Level 1 (0 points)

              Thanks for your reply. The idea is we have an accessory that needs to connect to the user's home wifi network. I want to make this as easy as possible for the user. So if their phone is already connected to a wifi network I can guess that they also want to connect the accessory to this same wifi network, with the option of letting them select a different wifi network if necessary. However, the accessory can only connect to 2.4ghz networks so I would like to do this additional check before suggesting this network to the user.

            • Re: Current Wifi Check for 2.4Ghz
              reid0008 Level 1 Level 1 (0 points)

              If anyone has another way to check if the current wifi network is 2.4g or 5.0g, I am still looking for a solution. Although I can check the name of the wifi network for the number "5" this is not 100% reliable so I would like to have some alternatives. Thanks!

              • Re: Current Wifi Check for 2.4Ghz
                eskimo Apple Staff Apple Staff (12,475 points)

                I am using CNCopyCurrentNetworkInfo to get the SSID of the current wifi connection.

                Be aware that CNCopyCurrentNetworkInfo has changed in iOS 13 beta.  WWDC 2019 Session 708 Designing for Privacy has some general background on this change and the docs have been updated with the details.

                I am wondering if there is a way to tell whether this WiFi is 2.4 or 5.0Ghz?

                No.  iOS has always placed strict limits on what apps can do with Wi-Fi, and there’s never been a supported API for getting low-level Wi-Fi information like this.

                The idea is we have an accessory that needs to connect to the user's home wifi network.

                My recommendation here is that you support Wireless Accessory Configuration (WAC) in your accessory.  This post has links to more info on that technology.

                Share and Enjoy

                Quinn “The Eskimo!”
                Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                let myEmail = "eskimo" + "1" + "@apple.com"