NEHotspotHelper registerWithOptions:queue:handler:] is causing crash randomly

Hi,


I am using NetworkExtension framwork for getting the list of all the available wifi's SSID. I am using below code:

let bundleId = NSBundle.mainBundle().bundleIdentifier!

var options:Dictionary<String, NSObject> = Dictionary(minimumCapacity: 1)

options[kNEHotspotHelperOptionDisplayName] = Constants.kDescriptionWiFiAnnotation

let queue:dispatch_queue_t = dispatch_queue_create(bundleId, DISPATCH_QUEUE_CONCURRENT)

let _ = NEHotspotHelper.registerWithOptions(options, queue: queue, handler: {(command) -> Void in

switch command.commandType {

case .FilterScanList:

//adding ssids to a local variable here

//handled other cases as well

}


But this code is casuing crash sometimes. I'm not sure what is wrong here. Here is the crash report:

#9. Crashed: App's Bundle Identifier here

0 App Name 0x1be324 __hidden#12577_ (__hidden#12751_)

1 App Name 0x1bc87c __hidden#12577_ (__hidden#12751_:192)

2 NetworkExtension 0x2ff717ed __53+[NEHotspotHelper registerWithOptions:queue:handler:]_block_invoke + 72

3 CaptiveNetwork 0x2a603033 __CNPluginHandleCommandInfo_block_invoke + 26

4 libdispatch.dylib 0x238b3cbf _dispatch_call_block_and_release + 10

5 libdispatch.dylib 0x238bc6d5 _dispatch_async_redirect_invoke + 1368

6 libdispatch.dylib 0x238bf6a1 _dispatch_root_queue_drain + 1572

7 libdispatch.dylib 0x238bf07b _dispatch_worker_thread3 + 94

8 libsystem_pthread.dylib 0x23a52e0d _pthread_wqthread + 1024

9 libsystem_pthread.dylib 0x23a529fc start_wqthread + 8


It doesn't provide any other information. Can anyone please let me know what is wrong here.

This crash was not there ealier, it is happening after recent iOS updates.


Thanks in advance.

Replies

This is crashing within your code (as clearly indicated by frames 0 and 1 in the backtrace you posted). It’s hard to say what’s going on without a symbolicated backtrace. Did you redact the symbols from the backtrace (that is, replace them with

__hidden
)? Or is that an artefact of the crash reporting tool you’re using?

ps You wrote:

I am using NetworkExtension framwork for getting the list of all the available wifi's SSID.

If you’re only objective is to get a list of SSIDs, you’re on the wrong path here. You might want to read this post, and its associated thread, for context.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"