Plugin returns "Not avaiable" error
thejavascriptman opened this issue · comments
Prerequisites
Check all boxes if you have done the following:
- Checked that your issue isn't already filed: https://github.com/tripflex/wifiwizard2/issues
- Make sure you fill out the Issue Type below
Issue type
Select all that apply
- Bug
- Enhancement
- Task
- Question
- Other
Description
Plugin returns returns "Not avaiable" error on iOS 13 when getConnectedSSID()
is called, same application was working just fine on iOS 12. Also checked the app permissions and updated dependencies, but problem persists.
Steps to Reproduce
- Build Ionic application and install on a device running iOS 13.1.3
- Connect to any wifi network on the iOS device
- Trigger the
getConnectedSSID()
method from anywhere in the code (make sure promise gets called after device is ready) e.g.
WifiWizard2.getConnectedSSID()
.then(result => alert(JSON.stringify(result)))
.catch(error => alert(JSON.stringify(error)))
Expected behavior:
The method should resolve successfully and result
should be shown in the alert message
Actual behavior:
The method does not resolve and the catch
callback is called, the message shown in the device is "Not available"
Reproduces how often:
100%
Versions
- iPhone 7
- iOS 13.1.3
- WifiWizard2 3.1.1
+1
Any updates on this? Getting the same behaviour
I'm unable to reproduce this on iOS13+
anyone have any updates on this how to use.
Getting the same error on iOS 13 when I try getConnectedSSID()
More Logs from iOS:
[log] - get Conntected SSID
To Native Cordova -> WifiWizard2 getConnectedSSID WifiWizard21130167911 ["options": []]
2019-12-21 23:29:06.985394+0100 App[956:408446] Supported interfaces: (
en0
)
2019-12-21 23:29:06.988576+0100 App[956:408446] [] nehelper sent invalid result code [1] for Wi-Fi information request
2019-12-21 23:29:06.988721+0100 App[956:408446] en0 => (null)
Seems to be related to the Location Permission
Found out some more stuff. NEHotspot is only returning the SSID if you already connected to it through your app.
Here is a fix if anyone wants to test it:
Just add
"cordova-plugin-wifiwizard2": "git+ssh://git@github.com/digaus/WifiWizard2.git#master"
to package.json
and run npm install
The same issues.
In iOS 13.1.3, before calling the plugin, I checked programmatically whether the location service and location permission of the mobile phone were turned on, but the plugin still returned a "Not avaiable" error.
The plugin works fine on any other iOS 13 system, including the latest iOS 13.2.3
Could it be a specific version error of iOS 13.1.3?
The same issues.
In iOS 13.1.3, before calling the plugin, I checked programmatically whether the location service and location permission of the mobile phone were turned on, but the plugin still returned a "Not avaiable" error.
The plugin works fine on any other iOS 13 system, including the latest iOS 13.2.3
Could it be a specific version error of iOS 13.1.3?
Might be the case.
I only did test on the latest version.
Is anyone having any issues connecting to a network in iOS 13.3+?
Is anyone having any issues connecting to a network in iOS 13.3+?
Seems to occasionally happen there too:
https://forums.developer.apple.com/thread/123544
Seems to be a bug in iOS
Does anyone have found the solution to this problem. I am still getting Not Found
on iOS 13.3
Same here. Anything new on this issue?
@zabojad Is your system version also iOS 13.1.3?
is there a fix for this issue? I saw it should be fixed with xcode 11.4 and ios 13.4 but no luck for me.
anyone?
It's not a very satisfying solution, but I am using the plugin cordova-plugin-geolocation to request the current location of the device when the app starts and if the user accepts the location access, WifiWizard2.getConnectedSSID()
returns the correct SSID. Otherwise I am getting Not available
.
At the moment this is running fine on iOS 13.5.1.
In general I would be happy to have a solution without location access, because the app has nothing to do with the location and however the user has to accept it, but iOS seems to be restrictive with the wifi information (hint from an apple forum).
@arsenal942 @andreareidel @digaus
Call WifiWizard2.getConnectedSSID()
will throw Not available
error on device of iOS 14 Beta
.
The following is the console log:
2020-07-07 15:04:45.414730+0800 SmartHome[77847:3122999] Supported interfaces: (
en0
)
2020-07-07 15:04:45.430937+0800 SmartHome[77847:3122999] [] nehelper sent invalid result code [1] for Wi-Fi information request
2020-07-07 15:04:45.431060+0800 SmartHome[77847:3122999] en0 => (null)
2020-07-07 15:04:45.431224+0800 SmartHome[77847:3122999] THREAD WARNING: ['WifiWizard2'] took '64.452148' ms. Plugin should use a background thread.
2020-07-07 15:04:45.447312+0800 SmartHome[77847:3122999] ERROR: Not available
package.json
"cordova-plugin-wifiwizard2": "git+https://github.com/tripflex/WifiWizard2.git"
Then, I tried to switch the npm package to digaus
"cordova-plugin-wifiwizard2": "git+https://github.com/digaus/WifiWizard2.git"
Still throws this error.
I have checked the location authorization and I have connected a WiFi hotspot.
This may be fatal, because Apple will release the official version of its iOS 14 system in the near future.
If I still need to provide any information, I can provide it immediately.
I tried to switch the npm package to digaus
"cordova-plugin-wifiwizard2": "git+https://github.com/digaus/WifiWizard2.git"
Still throws this error.
What should I do?
I am importing it like this.
"cordova-plugin-wifiwizard2": "git://github.com/digaus/WifiWizard2.git#master", "wifiwizard2": "git://github.com/digaus/WifiWizard2.git#master",
Then I deleted everything like node_modules, platforms, .. Just standard things.
I also updated xcode to the latest version
The error Not available
will still be raised.
Here is my message:
Xcode: 12.0 beta
iOS: 14.0 beta
cordova-ios: 5.1.1
cordova-plugin-wifiwizard2: git://github.com/digaus/WifiWizard2.git#master
wifiwizard2: git://github.com/digaus/WifiWizard2.git#master
When calling WifiWizard2.getConnectedSSID()
, here is the information output by the Xcode console:
2020-07-07 15:58:47.504556+0800 SmartHome[82414:3160191] Supported interfaces: (
en0
)
2020-07-07 15:58:47.558583+0800 SmartHome[82414:3160191] [] nehelper sent invalid result code [1] for Wi-Fi information request
2020-07-07 15:58:47.558761+0800 SmartHome[82414:3160191] en0 => (null)
2020-07-07 15:58:47.558957+0800 SmartHome[82414:3160191] THREAD WARNING: ['WifiWizard2'] took '81.027100' ms. Plugin should use a background thread.
2020-07-07 15:58:47.610462+0800 SmartHome[82414:3160191] ERROR: Not available
Why nehelper sent invalid result code [1] for Wi-Fi information request
?
The error
Not available
will still be raised.Here is my message:
Xcode: 12.0 beta iOS: 14.0 beta cordova-ios: 5.1.1 cordova-plugin-wifiwizard2: git://github.com/digaus/WifiWizard2.git#master wifiwizard2: git://github.com/digaus/WifiWizard2.git#master
When calling
WifiWizard2.getConnectedSSID()
, here is the information output by the Xcode console:2020-07-07 15:58:47.504556+0800 SmartHome[82414:3160191] Supported interfaces: ( en0 ) 2020-07-07 15:58:47.558583+0800 SmartHome[82414:3160191] [] nehelper sent invalid result code [1] for Wi-Fi information request 2020-07-07 15:58:47.558761+0800 SmartHome[82414:3160191] en0 => (null) 2020-07-07 15:58:47.558957+0800 SmartHome[82414:3160191] THREAD WARNING: ['WifiWizard2'] took '81.027100' ms. Plugin should use a background thread. 2020-07-07 15:58:47.610462+0800 SmartHome[82414:3160191] ERROR: Not available
Why
nehelper sent invalid result code [1] for Wi-Fi information request
?
Did you enable the WiFi information access within your Apple account? You should see the capabilities in XCode as well if they are enabled.
I will test this on ios 14 I am using 13
The culprit is the "Precise Location" switch in the location authorization. If it is turned off, a Not available error will be returned.
This option is newly added in iOS 14.
Regarding location authorization, Apple has abandoned some APIs and added some Beta APIs. This is a document on Apple's official website: https://developer.apple.com/documentation/corelocation/cllocationmanager
In the cordova-diagnostic-plugin
plugin, the same issue was opened: dpa99c/cordova-diagnostic-plugin#402
On iOS 14 when a user grants location authorization to an app, the app is by default only given access to "reduced accuracy" location data.
If your app requires "full accuracy" (high-accuracy GPS) location data, you need to request temporary access (you can't request it permanently) via the newrequestTemporaryFullAccuracyAuthorization()
method.
This requires the user to authorise full accuracy each time you need it via a new authorisation prompt which displays the newNSLocationTemporaryUsageDescriptionDictionary
plist key.
The current accuracy level is indicated by theaccuracyAuthorization
property ofCLLocationManager
asCLAccuracyAuthorization
constants.We need to extend this plugin to expose these new methods and constants.
This should be done conditionally in a backwardly-compatible way so as not to break builds which use an SDK version lower than iOS 14.Note: iOS 14 public release date is due ~14 September
Maybe this part of our inspection location can be done using this library? Because checking whether the user authorized the location is not actually a task of our plug-in, it is only necessary to check the necessary process for our plug-in to work properly.
Edit: I removed some of my invalid comments to keep this issue clean.
Has this issue been resolved?
iPhone 13pro,IOS 15.4.1,use getCurrentPosition() return "Not available",can you help solve this problem?