skip to Main Content

In iOS 15 we have following method to check WiFi security type:

@available(iOS 15.0, *)
open var securityType: NEHotspotNetworkSecurityType { get }

Do we have anything in iOS 11 to 14 to know WiFi Security type?

2

Answers


  1. In iOS 11 through iOS 14, there is no direct built-in method or property provided by Apple’s Network Extension framework or CoreWLAN framework to determine the security type of a Wi-Fi network. These versions of iOS did not offer a native API to retrieve the specific security type (e.g., WPA, WPA2, WEP) of a Wi-Fi network.

    To determine the security type of a Wi-Fi network in those iOS versions, you would typically need to analyze the network’s SSID and possibly try to infer the security type based on naming conventions or other available information. However, this method is not guaranteed to be accurate because network names can vary widely and may not provide a clear indication of the security type.

    Starting from iOS 15 and later, as you mentioned, the NEHotspotNetwork class includes the securityType property, which allows you to directly check the security type of a Wi-Fi network, making it more straightforward to determine the security type programmatically.

    Login or Signup to reply.
  2. In iOS versions 11 through 14, there isn’t a direct API like the securityType property from NEHotspotNetwork available in iOS 15 to determine the WiFi security type. Apple introduced more detailed APIs for working with network information in later versions of iOS.

    However, depending on your specific requirements, you might consider a few workarounds:

    1.Private APIs: Some developers have used private APIs to fetch detailed WiFi information, but this approach is not recommended. Using private APIs can get your app rejected from the App Store.

    2.NEHotspotHelper: NEHotspotHelper provides a way to interact with WiFi networks, but it’s mainly for creating custom hotspot helpers. Also, to use NEHotspotHelper, you need to obtain an entitlement from Apple, which is typically only granted for specific use cases.

    3.Fetching SSID: You can fetch the SSID (Service Set Identifier) of the WiFi network the device is connected to using the CNCopyCurrentNetworkInfo function. This doesn’t give you the security type, but sometimes the SSID might have clues (e.g., if it ends in _5G it’s likely a 5GHz network). This is a very indirect and unreliable method, but it’s sometimes used in the absence of better options.

    4.User Input: If it’s feasible for your use case, you could ask the user to provide the security type when they’re setting up a WiFi connection within your app.

    5.Assumption: If your app is designed for a specific environment (e.g., a corporate setting or a particular type of venue), you might be able to make reasonable assumptions about the WiFi security type.

    While iOS 15 provides a direct way to get the WiFi security type, earlier versions of iOS don’t offer a straightforward method. You might need to rely on indirect methods, assumptions, or user input, depending on your app’s requirements.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search