NEHotspotNetwork.fetchCurrentWithCompletionHandler gives a Nil for both SSID and BSSID

I use NEHotspotNetwork.fetchCurrentWithCompletionHandle, but it gives me Nil for both SSID and BSSID

#import "FPPHotspotNetworkInfoProvider.h"
#import <NetworkExtension/NetworkExtension.h>

@implementation FPPHotspotNetworkInfoProvider

- (void)fetchNetworkInfoWithCompletionHandler:
    (void (^)(FPPNetworkInfo *network))completionHandler
    API_AVAILABLE(ios(14)) {
  [NEHotspotNetwork fetchCurrentWithCompletionHandler:^(
                        NEHotspotNetwork *network) {
    dispatch_async(dispatch_get_main_queue(), ^{
      if (network) {
        completionHandler([[FPPNetworkInfo alloc] initWithSSID:network.SSID
                                                         BSSID:network.BSSID]);
        return;
      }
      completionHandler(nil);
    });
  }];
}

@end

Do I need approval from Apple for this? If so, could you please provide guidance on how to obtain it?

Thank you.

Replies

Do I need approval from Apple for this?

No. But, as it says in the docs, you must:

  • Sign your code with the com.apple.developer.networking.wifi-info entitlement. In Xcode this is the Access Wi-Fi Information capability.

  • Be authorised to get this info. The docs list all the ways to do that. Most commonly folks do this by requesting the Location permission from the user.

Share and Enjoy

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

  • Thanks Quinn for the answer !

    Sign your code with the com.apple.developer.networking.wifi-info entitlement. In Xcode this is the Access Wi-Fi Information capability.

    I already included this entitlement trough xcode.

    Be authorised to get this info. The docs list all the ways to do that. Most commonly folks do this by requesting the Location permission from the user.

    Yes, I'm already using CoreLocation with the permission of the user.

    And still the code returns Nil for both SSID and BSSID.

Add a Comment

Thanks Quinn for the answer !

Sign your code with the com.apple.developer.networking.wifi-info entitlement. In Xcode this is the Access Wi-Fi Information capability.

I already included this entitlement trough xcode.

Be authorised to get this info. The docs list all the ways to do that. Most commonly folks do this by requesting the Location permission from the user.

Yes, I'm already using CoreLocation with the permission of the user.

And still the code returns Nil for both SSID and BSSID.

This is on iOS, right? What version are you testing on?

I have a small test project that I used to exercise this stuff. I dusted it off and ran it on some devices here in my office (with iOS 17.3.1 and 17.4) and it worked as expected.

Share and Enjoy

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

Hello Quinn,

Thanks for the help, I was able to find the problem using your test project.

Best regards