admin管理员组文章数量:1638805
问题内容如下:
--- commonInit ---
[] nehelper sent invalid result code [1] for Wi-Fi information request
问题原因:
Answer1:
Check out WWDC 19 session 713, It happenes because in iOS13 in order to get WiFi details you should allow location permission, each time you try to pull CNCopyCurrentNetworkInfo data from CNCopySupportedInterfaces array you will get this log.
silly solution may be to try to enable location permission and you will not get this error anymore
Answer2:
I’ve managed to make it on iOS 13.3. Here goes how I make it.
The official documentation of CNCopyCurrentNetworkInfo says that the function is providing real SSID/BSSID of current connection if the app
has an “Access WiFi Information Entitlement” (see here) and
is one of 1) Core Location , 2) using NEHotspotConfiguration to connect current Wi-Fi Network, and 3) VPN app.
I’ve already configured “Access WiFi Information Entitlement”, therefore only meet the first requirement. It does work on iOS 13.1 but doesn’t work on iOS 13.3. To meet the latter requirement, I decided to include the Core Location in my APP. I’ve checked the code in here but I gotta to add some constants below on my app’s Info.plist to avoid error.
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Application requires user’s location for better user experience.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Application requires user’s location for better user experience.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Application requires user’s location for better user experience.</string>
I also needed to call
manager.requestWhenInUseAuthorization()
before
manager.requestAlwaysAuthorization()
to popup the dialog when user launch the app for the first time.
User needed to allow the permission at the first launch. If it is allowed as “Always”, the app can use CNCopyCurrentNetworkInfo without error.
Answer3:
It eventually turned out, that a third party framework that my app uses, launches those calls to CNCopyCurrentNetworkInfo.
After I added WiFi access capabilities as described here to the app itself the error message disappeared
问题分析
增加"Access WiFi Information" 权限后,网上搜索说这个方法可以,但实际测验依然没有解决
本文标签: InvalidresultxcodenehelperCode
版权声明:本文标题:问题:Xcode-nehelper sent invalid result code [1] for Wi-Fi information request 待解决 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1729279233a1193867.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论