Tarık Seyceri
Tarık Seyceri

Reputation: 463

Connect to WiFi using iOS app with GUI User Request not Programmatically

Since adding WiFi Network Programmatically in iOS is nearly impossible without jailbreaking the Iphone :(

Is it possible to make an application to provide wifi password hidden in stars ******** and ask the user to click on a button in app and connect to wifi network with the hidden password?,

What i mean is: the idea: Application provides the wifi password without user seeing the plain text password, but can click a button to open an Intent (dialog or something with the password provided and press connect manually) to connect to WiFi with the hidden WiFi password ( GUI User Request NOT Programmatically )

Is it possible to do that in Swift or Objective-C without jailbreaking the iphone?

Upvotes: 1

Views: 533

Answers (2)

Gaganpreet
Gaganpreet

Reputation: 116

You have to use MultipeerConnectivity for GUI wifi connection.

Step1: import MultipeerConnectivity

step2:

   var browser : MCBrowserViewController!

   var assistant : MCAdvertiserAssistant!

   var session : MCSession!

   var peerID: MCPeerID!

step3:

    Add  MCBrowserViewControllerDelegate, MCSessionDelegate

step4:

    self.peerID = MCPeerID(displayName: UIDevice.current.name)

    self.session = MCSession(peer: peerID)

    self.session.delegate = self

    self.browser = MCBrowserViewController(serviceType:serviceType,
                                           session:self.session)

    self.browser.delegate = self;

    self.assistant = MCAdvertiserAssistant(serviceType:serviceType,
                                           discoveryInfo:nil, 
                                                session:self.session)

    self.assistant.start()

step5: Next use session delegate methods.

I think it's helpful.

Upvotes: 1

Laffen
Laffen

Reputation: 2771

Yes, it is possible.

You must register your app as a HotSpot Helper to get access to the required API within the NetworkExtension framework.

Take a look at NetworkExtension.NEHotspotHelper and the Hotspot Network Subsystem Guide

For future questions, please provide some code showing what you have tried so far. This makes it easier for others to provide a helpful solution and it's easier for other people looking for a the same solution.

Upvotes: 1

Related Questions