iOS Question IOS How to disconnect wifi programatically.


B4X founder
Staff member
Licensed User
Longtime User
You can try to remove a configuration:
Dim no As NativeObject
no.Initialize("NEHotspotConfigurationManager").runMethod("sharedManager", null).RunMethod("removeConfigurationForSSID:", Array("ssid here"))
Not clear whether it will disconnect an active connection.

Upvote 0


Active Member
Licensed User
Longtime User

After add this code, sometimes error will occur.

Error: Error Domain=NEHotspotConfigurationErrorDomain Code=8 "internal error." UserInfo={NSLocalizedDescription=internal error.}
Error: Error Domain=NEHotspotConfigurationErrorDomain Code=13 "already associated." UserInfo={NSLocalizedDescription=already associated.}

Thank you
Last edited:
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
Apple talks
Removes a Wi-Fi configuration, identified by an SSID, that your app previously added.

Your app can use this method to delete a configuration that it has added, but not a configuration added by another app or by the user. The user can also delete configured networks through Settings > Wi-Fi.

Guess, you don't have a lot of routers, and IOS already knows your "new" configuration. So, first step is to forget all networks in IOS settings.
Upvote 0