Function CNCopyCurrentNetworkInfo

Source
pub extern "C-unwind" fn CNCopyCurrentNetworkInfo(
    interface_name: &CFString,
) -> Option<CFRetained<CFDictionary>>
👎Deprecated
Available on crate feature CaptiveNetwork only.
Expand description

Returns the network information for the specified interface when the requesting application meets one of following 4 requirements -.

  1. application is using CoreLocation API and has the user’s authorization to access location.
  2. application has used the NEHotspotConfiguration API to configure the current Wi-Fi network.
  3. application has active VPN configurations installed.
  4. application has active NEDNSSettingsManager configurations installed.
  • An application that is linked against iOS 12.0 SDK and above must have the “com.apple.developer.networking.wifi-info” entitlement.
  • An application will receive a pseudo network information if it is linked against an SDK before iOS 13.0, and if it fails to meet any of the above requirements.
  • An application will receive NULL if it is linked against iOS 13.0 SDK (or newer), and if it fails to meet any of the above requirements.
  • On Mac Catalyst platform, to receive current Wi-Fi network information, an application must have “com.apple.developer.networking.wifi-info” entitlement and user’s authorization to access location.

Network Information dictionary will contain the following keys, and values:


```text
    Keys                      : Values
    =======================================
    kCNNetworkInfoKeySSIDData : CFDataRef
    kCNNetworkInfoKeySSID     : CFStringRef
    kCNNetworkInfoKeyBSSID    : CFStringRef
```

Pseudo network information will contain “Wi-Fi” SSID and “00:00:00:00:00:00” BSSID. For China region, the SSID will be “WLAN”.

Parameter interfaceName: Name of the interface you are interested in

Returns: Network Information dictionary associated with the interface. Returns NULL if an error was encountered. You MUST release the returned value.