Schavcovsky
Schavcovsky

Reputation: 81

Programmatically auto-connect to WiFi iOS

I'm creating an app on Swift, and I need to know, if there's any way I can programatically auto connect an iPhone to a WiFi giving as paremeters the SSID and the Password from that WiFi Network.

Thanks in advance.

Upvotes: 5

Views: 11248

Answers (3)

wzso
wzso

Reputation: 3885

Quotation from Apple Developer Documentation:

The NEHotspotHelper interface allows an app to participate in the process of joining Wi-Fi/hotspot networks. Such an app is referred to as a Hotspot Helper. A Hotspot Helper receives commands to be processed in the background that allow it to participate in the Hotspot Network state machine.

Upvotes: 1

Mayur Rathod
Mayur Rathod

Reputation: 394

Below code will work on Xcode 9 and iOS 11

let WiFiConfig = NEHotspotConfiguration(ssid: "Mayur1",
                                                  passphrase: "123456789",
                                                  isWEP: false)

    WiFiConfig.joinOnce = false
    NEHotspotConfigurationManager.shared.apply(WiFiConfig) { error in
        // Handle error or success
        print(error?.localizedDescription)

Upvotes: 5

brimstone
brimstone

Reputation: 3400

Not possible unfortunately! Too many issues that Apple would be not okay with. If you're working with a jailbroken device it may be possible (if it's not going on the app store, either)

Here's a question similar to yours you might want to look at

Upvotes: 0

Related Questions