On iOS 13.1, CNCopyCurrentNetworkInfo occasionally doesn't work.

Altough we are using NEHotspotConfiguration API to configure the current Wi-Fi network, occasionally CNCopyCurrentNetworkInfo returns NULL. The only way to recover was rebooting the phone (I haven't tried resetting the network settings as was suggested else where). Regardless ,this sounds like a bug in the API and I was wondering if others see the same problem and/or if it's a known issue and is getting addressed.

Thanks!

@eskimo is fetchCurrentWithCompletionHandler synchronous or aysnchronous in terms of the completion handler? e.g. Our code base using CNCopyCurrentNetworkInfo is synchronous, but if fetchCurrentWithCompletionHandler is aysnchronous for the completion handler, our code base might have a problem.

And in terms of mem leak, thew shiny new API is still proposing leaking, I only write a simple for loop with a pool:

   for (int i = 0; i < 100000; i++) {
    @autoreleasepool {
      [NEHotspotNetwork fetchCurrentWithCompletionHandler:^(NEHotspotNetwork * _Nullable currentNetwork) {
        NSString *ssid = currentNetwork.SSID;
        NSString *bssid = currentNetwork.BSSID;
        NSString *network = [[NSString alloc] initWithFormat:@"%@,%@", ssid, bssid];
      }];
    }
  }

I'm not sure if it's real leaks. I filed both API with bug number 9936268: https://feedbackassistant.apple.com/feedback/9936268

FB9936268> is +fetchCurrentWithCompletionHandler: synchronous or aysnchronous

in terms of the completion handler?

Async.

I'm not sure if it's real leaks.

It certainly looks that way.

FB9936268

Thanks.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

On iOS 13.1, CNCopyCurrentNetworkInfo occasionally doesn't work.
 
 
Q