hello i am using cncopycurrentnetworkinfo for getting the data (ssid,bssid) for the connected wifi network but according to the link https://developer.apple.com/documentation/systemconfiguration/1614126-cncopycurrentnetworkinfo showing Deprecated and showing possible solution is using the method fetchCurrentWithCompletionHandler:(https://developer.apple.com/documentation/networkextension/nehotspotnetwork/3666511-fetchcurrentwithcompletionhandle) this is method of HotspotHelper and i also email networkextension@apple.com ask for that entitlement (com.apple.developer.networking.HotspotHelper) used by HotspotHelper but got rejected.
so is there any other possible solution?
https://developer.apple.com/forums/thread/675211?answerId=664741022#664741022
I got the answer from apple developer forum
+fetchCurrentWithCompletionHandler: does not require the Hotspot Helper entitlement. Unfortunately that fact is not documented officially (r. 74976266). Fortunately, there’s lots of good info about this method in the doc comments in <NetworkExtension/NEHotspotNetwork.h>.
here is the implemented example. hope this helps others
if (@available(iOS 14.0, *)) {
[NEHotspotNetwork fetchCurrentWithCompletionHandler:^(NEHotspotNetwork * _Nullable currentNetwork) {
NSString *strSSID = [currentNetwork SSID];
}];
} else {
NSArray *ifs = (__bridge_transfer NSArray *)CNCopySupportedInterfaces();
NSDictionary *info;
for (NSString *ifnam in ifs) {
info = (__bridge_transfer NSDictionary *)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);
if (info && [info count]) {
NSString *strSSID = [info objectForKey:@"SSID"];
break;
}
}
}