I have a react native app for iOS. I am using the the simulator via xCode for development.
I am trying to use the below library to get the SSID or even connect to an SSID but keep getting an internal error.
Package: https://www.npmjs.com/package/react-native-wifi-reborn
I have Access WIFI Information
enabled on xCode. I was getting an issue previously and by adding this it resolved it but now I get a response just as internal error
.
Example
WifiManager.getCurrentWifiSSID().then(
ssid => {
console.log("Your current connected wifi SSID is " + ssid);
},
(err) => {
console.log("Cannot get current SSID! " + err);
}
);
Response
Cannot get current SSID! internal error
Note that on the simulator I do not see any Wifi Settings at all. Is this the issue? Must I use a physical device for this to work?
2
Answers
Have you tried add the Hotspot Configuration Entitlement also?
https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_networking_hotspotconfiguration?language=objc
I should not be needed just to get the SSID, but I believe react-native-wifi-reborn requires it. I got internal errors when trying to connect to a protected SSID without it.
From the link (https://www.npmjs.com/package/react-native-wifi-reborn) that you have provided:
com.apple.developer.networking.wifi-info
andcom.apple.developer.networking.HotspotConfiguration
(if you need this) should be added to capabilities of your iOS app.You should add these keys with description into
Info.plist
of your iOS app project.