Is it possible to connect to WLAN using swift, in case I receive WLAN SSID and password from API with my permissions, and before connection I also accept Terms & Conditions. So as a user I totally agree that to happen through a particular app. So I'll search for/or get my local area network by name/WLAN SSID, and connect to it by password but all should go through code. The point is that even though I've a secured wlan, everyone who comes to my store and has my app to be able to connect to wifi even though it's secured.
Related
I am looking to design a way to configure wifi setup for a non-apple device, by pairing it via bluetooth with an app on an iPhone.
The iPhone would be one already connected to the target wifi network. The app would support its own bluetooth connection with the non-apple device
I understand that there are entitlements, like CNCopyCurrentNetworkInfo, but from research it doesn't look like that is enough. Maybe there are others? Or is this only possible by being approved to implement HomeKit on the 'target non-apple device'?
The presume path of data is
credential stored in iOS
some entitlement that permits access to unencrypted data
app with entitlement
app security handles data
valid bluetooth pairing of the app
unencrypted password sent via bluetooth
non-apple device uses the network SSID + credential to make its own connection
Thanks for your help or corrections. These existing Q&A do not answer it: 1, 2
CNCopyCurrentNetworkInfo does not give you the password, even if you jump through all the hoops including users location permission. Theoretically you can only get SSID of the connected network (with location permission from the user)
Best humane way to approach this (as of today) is by asking the user to enter their WiFi SSID/password in a popup and send it to the Bluetooth device. I was not able to find a better way.
If you use something like Blufi, you can :
have BT device scan for available hotspots
display the list of hotspots for the user
have them select the network + enter the password manually
send the credentials to the Bluetooth device
PS. it would be quite spooky if there was a way to read system keychain passwords from an app.
I am implementing an app through Xamarin.
Is it possible to programmatically connect to an SSID which is already remembered by the phone in iOS?
No, it is not possible to connect to a known network, without providing the necessary credentials, due to various security reasons.
In order to connect to a network, you need to create a NEHotspotConfiguration
The class requires either only SSID (for open networks), or SSID with some credentials for authentication.
After the configuration is created, you can connect via NEHotspotConfigurationManager like so:
await NEHotspotConfigurationManager.SharedManager.ApplyConfigurationAsync(config);
NB: Keep in mind that to connect to a network, you need to enable the Hotspot capability in your App Capabilities Working with capabilities.
I want to get wifi's SSID and password from server and I have to check any available wifi's SSID is matched with my server's SSID. If any matched, I have to connect with that wifi using its password. I have read many post related to this but I couldn't get any answer.
This is not possible in iOS. The only thing you can retrieve is the SSID after the user has connected to one of the Wi-Fi networks using the regular iOS UI.
You can use Hotspot Configuration to register SSID/password to connect to.
For more info, see iOS - How to programmatically connect to a WiFi network given the SSID and Password using a private/3rd party library
There's a wireless network I'm connecting to using my iOS device. In order to access the internet, a captive portal page is displayed prompting for a username and password. I would like my device to ignore that page and remain connected to the wireless lan. I don't mind if I can't get on to the internet - I just want to connect to another device on the wifi network. I can do this on other devices (android, laptops etc), it's just iOS devices that seem to enforce a "use captive portal or be disconnected" policy.
So, is there a way for my iOS device to remain connected to a wifi lan that has a captive portal?
This is a well-known problem with iOS. Apple assumes, incorrectly in my view, that any iOS Wi-Fi connected device must access the Internet and must be able to reach Apple's servers (of which there are dozens, only one of which is apple.com).
The device chooses a server apparently randomly from a list and attempts to load a specific HTML file in a random file path from the chosen server.
If the device is connected to the Wi-Fi access point but can't reach Apple, iOS assumes that the user has not logged into the access point and thus must be shown the captive portal login page.
This has caused grief to developers who want the user device only to access web resources on the local network, where no Internet access is provided or needed; and when the access point is open with no login required. The captive portal page just confuses the user.
The solution is to spoof the Apple servers. The only way I know of is to configure a web server to note certain nonrandom content in the HTTP attempts from the user device, and to supply the file the device is looking for. This is how the LibraryBox and PirateBox do it. Check LibraryBox.us.
When a user walks into a physical store, is it possible to verify if a particular WiFi SSID is available (may be searching with first few characters) and if yes, can we automatically connect to that WiFi programmatically? Getting consent from the user for first time is OK, but if user gives the consent, we should be able to automatically connect subsequent times. I know Captive framework can be used to get the connected WiFi details, but can we leverage that framework to implement the above requirement as well? Appreciate any quick inputs.
No, this is not possible. You can indeed only get the SSID once connected.