skip to Main Content

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


  1. 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.

    Login or Signup to reply.
  2. From the link (https://www.npmjs.com/package/react-native-wifi-reborn) that you have provided:

    iOS
    You need use enable Access WIFI Information, with correct profile. Hotspot Configuration is required in order to connect to networks.

    com.apple.developer.networking.wifi-info and com.apple.developer.networking.HotspotConfiguration (if you need this) should be added to capabilities of your iOS app.

    iOS 13
    You need put "Privacy – Location When In Use Usage Description" or "Privacy – Location Always and When In Use Usage Description" in Settings -> info

    You should add these keys with description into Info.plist of your iOS app project.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search