JuanSeBestia/react-native-wifi-reborn

iOS 17 WifiManager.getCurrentWifiSSID Error

badpinkman opened this issue · 9 comments

try { const ssid = await WifiManager.getCurrentWifiSSID(); } catch (error) { LogActions.info(---------- get Wifi error = [${JSON.stringify(error)}]); }
[Info] ---------- get Wifi error = [{"code":"couldNotDetectSSID","message":"Cannot detect SSID","domain":"RCTErrorDomain","userInfo":null,"nativeStackIOS":["0 XXXXX 0x000000010140f540 RCTJSErrorFromCodeMessageAndNSError + 112","1 XXXXX 0x00000001013b18c4 __41-[RCTModuleMethod processMethodSignature]_block_invoke_2.73 + 152","2 XXXXX 0x00000001013028fc __33-[WifiManager resolver:rejecter:]_block_invoke.53 + 176","3 XXXXX 0x0000000101300d30 __27-[WifiManager getWifiSSID:]_block_invoke + 108","4 NetworkExtension 0x000000019906c194 __54+[NEHotspotNetwork fetchCurrentWithCompletionHandler:]_block_invoke + 176","5 NetworkExtension 0x00000001990607e8 __NEHelperSendRequest_block_invoke_2 + 136","6 libxpc.dylib 0x00000001800c92e0 _xpc_connection_reply_callout + 60","7 libxpc.dylib 0x00000001800bcd30 _xpc_connection_call_reply_async + 76","8 libdispatch.dylib 0x00000001058719b4 _dispatch_client_callout3 + 16","9 libdispatch.dylib 0x0000000105890bcc _dispatch_mach_msg_async_reply_invoke + 572","10 libdispatch.dylib 0x0000000105881494 _dispatch_main_queue_drain + 892","11 libdispatch.dylib 0x0000000105881108 _dispatch_main_queue_callback_4CF + 40","12 CoreFoundation 0x00000001803f1a30 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12","13 CoreFoundation 0x00000001803ec148 __CFRunLoopRun + 1936","14 CoreFoundation 0x00000001803eb5a4 CFRunLoopRunSpecific + 572","15 GraphicsServices 0x000000018e9fbae4 GSEventRunModal + 160","16 UIKitCore 0x00000001852f02e4 -[UIApplication _run] + 868","17 UIKitCore 0x00000001852f3f5c UIApplicationMain + 124","18 XXXXX 0x0000000100eab3d0 main + 100","19 dyld 0x00000001048d5544 start_sim + 20","20 ??? 0x000000010497e0e0 0x0 + 4372029664","21 ??? 0xfd21800000000000 0x0 + 18240000703315574784"]}]
`
The above operation can be used normally in Android. But it cannot be used normally in iOS.
(
The following information has been added to Info.plist:
< Key > NSLocalNetworkUsageDescription
< string >
< Key > NSLocationAlwaysAndWhenInUseUsageDescription
< String > Allow $ (PRODUCT_NAME) to use your location
< Key > NSLocationAlwaysUsageDescription
< String > Allow $ (PRODUCT_NAME) to use your location
< Key > NSLocationWhenInUseUsageDescription
< String > Allow $ (PRODUCT_NAME) to use your location

And I have confirmed that I have the location permission.
Const result = await check (PERMISSIONS. IOS. LOCATION_WHEN_IN_USE);
LogActions.info (`---------- LOCATION_WHEN_IN_USE = [${result}] ');
[Info ] ---------- LOCATION_WHEN_IN_USE = [granted]
)

`

My environment is:
"React": "18.2.0",
"React-native": "0.72.7",
"react-native-wifi-reborn": "^ 4.10.1",

iOS 17.2
As the above log shows, getting the current WiFi SSID failed. Is it my fault? Thanks very much.

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community attention? This issue may be closed if no further activity occurs.

Is anyone experiencing the same problem as me? o(╥﹏╥)o

getting this error when calling WifiManager.getCurrentWifiSSID() any idea how can i resolve this on ios?

getting this error when calling WifiManager.getCurrentWifiSSID() any idea how can i resolve this on ios?

Did you also encounter this problem?

getting this error when calling WifiManager.getCurrentWifiSSID() any idea how can i resolve this on ios?

Did you also encounter this problem?

yes

getting this error when calling WifiManager.getCurrentWifiSSID() any idea how can i resolve this on ios?

Did you also encounter this problem?

yes

That's unfortunate.
Are you using iOS team developer account?
There is a possibility that you do not have the relevant permission to turn on Wi-Fi in the developer account in the Apple background, but the individual developer does not have this permission. If you are an individual developer, you need to confirm this problem.

getting this error when calling WifiManager.getCurrentWifiSSID() any idea how can i resolve this on ios?

Did you also encounter this problem?

yes

That's unfortunate. Are you using iOS team developer account? There is a possibility that you do not have the relevant permission to turn on Wi-Fi in the developer account in the Apple background, but the individual developer does not have this permission. If you are an individual developer, you need to confirm this problem.

no, i'm not using an individual developer account. it's the organisation account.

I was just able to resolve this issue after:

  1. Configure location permissions in ios you can follow the https://www.npmjs.com/package/react-native-permissions make sure the app has the location permissions granted.
  2. Add Access Wi-Fi information, Hotpot & Wireless Accessory Configuration in Signing & Capabilities using xCode.

Great, my Apple company account is still under review.

I have assigned the corresponding permissions. Due to the account number, there is no way to use Access Wi-Fi information, Hotpot & Wireless Accessory Configuration in Xcode signature.

If there is no problem with the application, I will close this issue.
Thanks a lot.