After upgrading to 15.1, SSIDs can no longer be scanned. In my main application, there is a wifiAccess.app in the LaunchService folder that is killed by embbed. This app is the root process that is placed under launchDaemon and loaded by launchd
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
if (@available(macOS 10.15, *)) {
[locationManager requestAlwaysAuthorization];
} else {
// erlier version do not need localtion permission
}
NSError *error;
NSData *ssidStrData = [ssid dataUsingEncoding:NSUTF8StringEncoding];
CWInterface *interface = [[CWWiFiClient sharedWiFiClient] interface];
NSSet<CWNetwork *> *networks = [interface scanForNetworksWithSSID:ssidStrData error:nil];
However, the obtained networks do not have ssid.
{(<CWNetwork: 0x600000368680> [ssid=(null), bssid=(null), security=WPA2 Enterprise, rssi=-49, channel=<CWChannel: 0x600000370bd0> [channelNumber=44(5GHz), channelWidth={20MHz}], ibss=0],
<CWNetwork: 0x600000370b30> [ssid=(null), bssid=(null), security=WPA2 Enterprise, rssi=-73, channel=<CWChannel: 0x600000370b00> [channelNumber=6(2GHz), channelWidth={20MHz}], ibss=0],
<CWNetwork: 0x600000370be0> [ssid=(null), bssid=(null), security=WPA2 Enterprise, rssi=-44, channel=<CWChannel: 0x600000370c60> [channelNumber=165(5GHz), channelWidth={20MHz}], ibss=0]
},
the main program has granted the location permission, but the location authorization has not responded in this wifiaccess process. And
(lldb) po [locationManager authorizationStatus]
kCLAuthorizationStatusNotDetermined.
The output authorization is always unauthorized, but only the authorization option of the main application can be seen in the system Settings location permissions setting, wifiaccess.app is not present on the list