How To Enable the WiFi Information Entitlement - ios

I'm making a react-native application for a DVR device, and updates happen via wifi, I need to get information about this connection, specifically ssid, I tried using react-native-wifi-reborn, but I can't get it, in the description of the library it is written that it is necessary to grant rights to wifi through capabilities, but there is no such thing, and every time I get an error that the ssid was not received, I will be grateful for any information, thanks
used the library and its methods, but it doesn't help

the problem is that I used the simulator, and I could get data about wi-fi only after I add it to the apple store connection, there, when adding App ID, it indicated that I needed access to Wi-Fi, that's the only way I got access to it

Related

Can an iPhone have entitlements to get decrypted wifi password info, e.g. to send by bluetooth?

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.

how to disable wifi assist without user interaction

I have couple of URLs that has to be called(programatically) through wifi not with mobile data.
As WIFI ASSIST is on , whenever the wifi is weak ,packets get transferred through Mobile data.
I would like to stop this from happening.
As far as I have researched, there is no API to toggle wifi assist switch on and off programatically
I can find if the user has mobile data and wifi on with the help of Reachability Class I believe and I can alert the user to keep wifi assist off but this is a very bad user experience.
so I decided to look if its possible to be done with the help of iOS mobile configuration file.
But I couldn't find any keys related with wifi-assist in Apple configuration profile reference.
so I am wondering , is it possible to force wifi to be used for certain URLs.
I remember this is possible with VPN ON DEMAND we can have certain domains to be accessed via VPN.
I am wondering if same is possible for wifi as well through configuration profile
Any suggestions are welcome.
As others have mentioned, there is no way to do manipulate this setting programmatically in iOS. This is not really what you are asking, as you seem to already know the answer to this is "No".
You are asking about the configuration profile, so I am assuming these are managed devices. Unfortunately, there is no configuration profile payload I am aware of that forces the managed devices to disable Wi-Fi Assist.
Your intent, however, is a bit different than what is being asked, I believe. I think you basically have an app that communicates with a resource that is only accessible via the Wi-Fi network (likely a corporate Wi-Fi network). If the app tries to connect to the resource while on cellular, it will not be able to connect. In some cases, when the Wi-Fi signal is weak, the device tries to be helpful and switches to cellular, causing issues with the app. If we could figure out a way to force iOS to not take advantage of Wi-Fi Assist when your app is running, you would be in good shape.
If you can install this app as a managed app, there is a way to identify that the app should only be allowed to run on a Wi-Fi connection. Setting the network usage rules AllowCellularData to false should do this (see this for more details). The thing I am not sure of with this solution, is whether this simply causes the connections to fail when Wi-Fi Assist is on and active, or if it makes iOS prefer to not use Wi-Fi assist when the app is running because it cannot connect over cellular. So I think you can tell an app to only connect over WiFi, but it doesn't really give you a better solution to your user experience problem. The only think it really buys you is that your app connection won't ever try to connect when connected to cellular. There is a chance, however, if you change this value to false for your app bundle ID, it will prevent Wi-Fi Assist from enabling when your app is running. I don't have access to MDM to try it out, but you could test and see.
Ultimately, given that this is probably a corporate device situation, I think you are going to have to address this through user training. The good news is that this is a one-time step. Sure, users may have slight degradation of network performance when Wi-Fi signal is weak but cell signal is strong. This does not matter as much if these are corporate devices where the corporate apps will mostly work only on the company's Wi-Fi network.
Another solution is what you mentioned, basically using on-demand VPN to provide a connection to the internal resources. This is additional infrastructure work, and you already mentioned it, so I'm not sure if it is even an option.
Obviously, the other solution would be to expose the network resources through your firewall, which could allow you to access it over cellular. I'm suspecting this is not possible due to security constraints.
Unfortunately, there are not a lot of good options in this space. However, have hope that there is some way to do it, as Sonos appears to have done something to
allow their app to avoid switching to WiFi Assist while streaming to a local network resource: https://sonos.custhelp.com/app/answers/detail/a_id/4257/~/wi-fi-assist-and-sonos
I wonder if you could have your app open a streaming audio connection to a fixed local network resource, which would cause it to use Wi-Fi. It's a pretty crazy hack, but with a low enough bitrate audio file streaming, it might do what you need while not eating up too much of the network throughput.
Per Apple's notes on Wi-Fi Assist:
Wi-Fi Assist won't automatically switch to cellular if you're data
roaming.
Wi-Fi Assist only works when you have apps running in the
foreground and doesn't activate with background downloading of
content.
Wi-Fi Assist doesn’t activate with some third-party apps
that stream audio or video, or download attachments, like an email
app, as they might use large amounts of data.
Of course the other possible solution that you could consider is improving your Wi-Fi coverage to that the signal doesn't get bad enough for Wi-Fi Assist to be needed. I know this may not be feasible, but wanted to put it out there.
Good luck with this!
There is no public API that allows you to enable/disable "Wi-Fi Assist", and even if you find a way to do it your app will be rejected.
No you can not enable or disable WiFi by programmatically and there is no API for this.

How to ask for authentication before connect to devices using bluetooth?

I want to make demo application, which contains following features.
search and show device list in my device Bluetooth range.
connect(pair) selected devices.
then share string data.
For doing that I am using core Bluetooth framework(Central and peripheral classes). using that I am able to search devices, connect devices and transfer string data also.
but I am not able to authenticate devices before pairing(when I call connect method it is directly shown me connected status). how is it handled in ios?
also please suggest me I am on the right path or I need to use another library to implement this functionality.
For anyone else beating their head against a wall, I have the solution to this issue. It's as simple as setting the AUTHENTICATION required flag for a characteristic on your BLE device. Once that flag is set, you need to attempt a READ from that service / characteristic using the iOS device. Once the read is requested, the BLE device will send back a failure message which then prompts iOS to display the PAIRING / BONDING popup. After that, you're golden.
Here is an example of a Cypress BLE device permission group. The settings are similar for most BLE embedded devices out there.
yes it is possible to ask pairing request from BLE device to ios.
I followed below steps to make ios app to ask for pairing.
edited my ble app to return error code 'RBLE_ATT_ERR_INSUFF_AUTHEN' using gatt write response function.
attempted a write from ios app then i got a prompt to enter pairing key.
used the randomly generated pairing key by BLE device to pair.
Paulw11's comment also helped me to solve that problem,
Regards
Bharath GK

Publish IOS App to Appstore with SSID ( wifi) discovery/connect through app

I was trying to get a specific info before a IOS App development task which I searched but couldn't find anything relevant.
Wanted to know whether this requirement restricts (non compliance issue as per publish guidelines) the app to be published in App Store with features as below
User scans and lists all available wifi connections in a tableview
Selects one of the Wifi connection and connects on button click
Stores the password and SSID for future connections.
Would there be any compliance issue related to the same functionalities when submitting to IOS app store. One of my colleague have advised me about the same but not able to explain why? Which I tried to find out searching the internet, but too specific to find anything relevant. Deeply appreciate an Expert advise on this.
Thanks in advance.
I can't find anything in the Review Guidelines that would object your app idea: https://developer.apple.com/app-store/review/guidelines
A couple of areas where you should have a more detailed look:
2.5.1 Apps may only use public APIs.
2.5.9 Apps that alter the functions of standard switches, such as the Volume Up/Down and Ring/Silent switches, or other native user
interface elements or behaviors will be rejected.
5.1 Privacy
Technically, I'm not sure if it's even possible to change the WIFI not via the settings app, so I'd have a look their first. (https://apple.stackexchange.com/questions/1592/is-there-an-ipod-app-to-easily-switch-wifi-on-and-off)
I don't believe I've ever seen an app or a way to change SSID outside the Settings app. I explored a way to detect network changes, connects, disconnects, which work fine while the app is running. I was never able to influence how the user connected, just that a change happened. It also falls apart pretty quickly when the user backgrounds the app. Trying to keep a background task open long enough to poll the current connection fails pretty fast.
I wish Apple would provide some system level notification of Wifi connect events. This could be very useful to developers that want a little more control than Background App Refresh events.

Automatically connect to a WiFi which has a specific SSID (atleast first few characters) from an iPad app

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.

Resources