NEHotspotConfigurationManager remove profile on exit

Hi,


I was wondering would it be possible to remove a profile created via NEHotspotConfigurationManager created via SSID.


NEHotspotConfigurationManager.shared.apply(myNetwork)


I seen in the documentation the use for:


func removeConfiguration(forSSID SSID: String)


However, my conscern is a user closing the app before the above function was called.


Is it possible to call this function during a "swipe, close" event?


Thanks in advance!

Accepted Reply

Is it possible to call this function during a "swipe, close" event?

I presume by ‘“swipe, close” event’ you mean the user removing the app from the multitasking UI? If so, the answer is “It depends.” To wit:

  • If you’re app is in the foreground then removing it from the multitasking UI will invoke your

    -applicationWillTerminate:
    delegate method.
  • Likewise if your app is running in the background, for example, via a

    UIApplication
    background task.
  • If your app is suspended in the background, it will be removed from memory without any of your code running.

  • If your app is terminated in the background then, well, it’s already terminated.

Have you thought about using

joinOnce
? This creates a temporary Wi-Fi configuration, one that’s automatically removed once your app is no longer frontmost.

Share and Enjoy

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

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

Replies

Is it possible to call this function during a "swipe, close" event?

I presume by ‘“swipe, close” event’ you mean the user removing the app from the multitasking UI? If so, the answer is “It depends.” To wit:

  • If you’re app is in the foreground then removing it from the multitasking UI will invoke your

    -applicationWillTerminate:
    delegate method.
  • Likewise if your app is running in the background, for example, via a

    UIApplication
    background task.
  • If your app is suspended in the background, it will be removed from memory without any of your code running.

  • If your app is terminated in the background then, well, it’s already terminated.

Have you thought about using

joinOnce
? This creates a temporary Wi-Fi configuration, one that’s automatically removed once your app is no longer frontmost.

Share and Enjoy

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

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