Someone help me, i need to connect to wifi by scan a qrCode in my Flutter APP

Hi, I'v got the error by using NEHotspotConfiguration to connect a wifi spot but get:NEHotspotConfigurationErrorDomain code=8. I hope to get the same result as when scanning the code with the system camera. A pop-up window will appear, and I just need to click "Join" to successfully connect.

Here's the logs:

[OneAppWifi][iOS] handleCheckWifiEnabled start (iOS 12+) [OneAppWifi][iOS] handleCheckWifiEnabled pathUpdateHandler status=satisfied [OneAppWifi][iOS] handleConnectWifi start, ssid=OPPO Find X6 Pro, pwd=len=16, authType=Optional("sae"), hidden=false [OneAppWifi][iOS] handleConnectWifi cancelPendingConnection before new request ssid=OPPO Find X6 Pro [OneAppWifi][iOS] cancelPendingConnection called, errorCode=nil, currentSsid=nil [OneAppWifi][iOS] cancelPendingConnection silent cancel, just clear pendingConnectResult [OneAppWifi][iOS] handleConnectWifi apply completion with error, domain=NEHotspotConfigurationErrorDomain, code=8, userInfo=["NSLocalizedDescription": internal error.] [OneAppWifi][iOS] resolveNEError NEHotspotConfigurationErrorDomain code=8 [OneAppWifi][iOS] resolveNEError systemConfiguration / internal, map to connection_failed [OneAppWifi][iOS] handleConnectWifi resolved as failure errorCode=Optional("connection_failed") for ssid=OPPO Find X6 Pro [OneAppWifi][iOS] firePendingResult value=["success": false, "errorCode": Optional("connection_failed")], currentSsid=Optional("OPPO Find X6 Pro")

Answered by Abel_Kefan in 880390022

Thank you very much for your patient response. However, I think my situation was different. After carefully reading the developer documentation, I realized that I hadn't added the Hotspot Configuration Entitlement to my certificate, which caused code 8 to appear. This issue was unrelated to the system version or device model. After I added the entitlement in Xcode, everything started working normally. Here is the link to the documentation, hoping it can help others: https://developer.apple.com/documentation/BundleResources/Entitlements/com.apple.developer.networking.HotspotConfiguration

Nevertheless, I still think it would be better if the error message for missing permissions could be isolated, providing a clearer hint to developers.

Accepted Answer

Error 8 is .internal. This has come up on the forums a bunch of times, so I decided to write up my advice in Understanding NEHotspotConfigurationErrorInternal.

Here's the logs:

That’s very hard to read. In future, please format such logs as a code block. See tip 5 in Quinn’s Top Ten DevForums Tips for advice on how to do that.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thank you very much for your patient response. However, I think my situation was different. After carefully reading the developer documentation, I realized that I hadn't added the Hotspot Configuration Entitlement to my certificate, which caused code 8 to appear. This issue was unrelated to the system version or device model. After I added the entitlement in Xcode, everything started working normally. Here is the link to the documentation, hoping it can help others: https://developer.apple.com/documentation/BundleResources/Entitlements/com.apple.developer.networking.HotspotConfiguration

Nevertheless, I still think it would be better if the error message for missing permissions could be isolated, providing a clearer hint to developers.

I realized that I hadn't added the Hotspot Configuration Entitlement

Oh, hey, would ya look at that. I can reproduce this myself using NEHotspotConfiguration Sample. If I remove the Hotspot capability I get error 8 when attempting to add a configuration.

I still think it would be better if the error message [provider] a clearer hint to developers

Agreed. Please file a bug requesting that and then post the bug number here.

And now I’m off to update Understanding NEHotspotConfigurationErrorInternal (-:

Thanks for sharing this titbit!

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Someone help me, i need to connect to wifi by scan a qrCode in my Flutter APP
 
 
Q