Hi,
I received email from Apple that mention after iOS 13 release then CNCopyCurrentNetworkInfo API will no longer return valid Wi-Fi SSID and BSSID information.
In Apple email, they got mention about NEHotspotConfiguration to configure the current Wi-Fi network, and apps that have obtained permission to access user location through Location Services.
After iOS 13 release, how can we get this info?
Thank you.
I received email from Apple that mention after iOS 13 release then CNCopyCurrentNetworkInfo API will no longer return valid Wi-Fi SSID and BSSID information.
In Apple email, they got mention about NEHotspotConfiguration to configure the current Wi-Fi network, and apps that have obtained permission to access user location through Location Services.
B4X:
#If OBJC
#import <SystemConfiguration/CaptiveNetwork.h>
- (NSString *)currentWifiSSID {
// Does not work on the simulator.
NSString *ssid = nil;
NSArray *ifs = (__bridge_transfer id)CNCopySupportedInterfaces();
for (NSString *ifnam in ifs) {
NSDictionary *info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);
// ssid = @"none";
if (info[@"SSID"]) {
ssid = info[@"SSID"];
}
}
return ssid;
}
- (NSString *)currentWifiBSSID {
// Does not work on the simulator.
NSString *bssid = nil;
NSArray *ifs = (__bridge_transfer id)CNCopySupportedInterfaces();
for (NSString *ifnam in ifs) {
NSDictionary *info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);
// ssid = @"none";
NSLog(@"info:%@",info);
if (info[@"BSSID"]) {
bssid = info[@"BSSID"];
}
}
return bssid;
}
#end if
After iOS 13 release, how can we get this info?
Thank you.