WifiWizard2 icon indicating copy to clipboard operation
WifiWizard2 copied to clipboard

Plugin returns "Not avaiable" error

Open thejavascriptman opened this issue 6 years ago • 27 comments

Prerequisites

Check all boxes if you have done the following:

  • [x] Checked that your issue isn't already filed: https://github.com/tripflex/wifiwizard2/issues
  • [x] Make sure you fill out the Issue Type below

Issue type

Select all that apply

  • [x] 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

  1. Build Ionic application and install on a device running iOS 13.1.3
  2. Connect to any wifi network on the iOS device
  3. 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

thejavascriptman avatar Oct 17 '19 02:10 thejavascriptman

+1 Any updates on this? Getting the same behaviour

alexhildebrand avatar Nov 19 '19 17:11 alexhildebrand

I'm unable to reproduce this on iOS13+

arsenal942 avatar Nov 20 '19 21:11 arsenal942

anyone have any updates on this how to use.

parthnayak7448 avatar Nov 24 '19 00:11 parthnayak7448

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)

https://stackoverflow.com/questions/58791035/ios-13-2-message-nehelper-sent-invalid-result-code-1-for-wi-fi-information-re

Seems to be related to the Location Permission

digaus avatar Dec 21 '19 22:12 digaus

Found out some more stuff. NEHotspot is only returning the SSID if you already connected to it through your app.

digaus avatar Dec 22 '19 10:12 digaus

Here is a fix if anyone wants to test it:

https://github.com/digaus/WifiWizard2/commit/061b681c43129f9abe54e6eaa705930362e1bb55

Just add "cordova-plugin-wifiwizard2": "git+ssh://[email protected]/digaus/WifiWizard2.git#master" to package.json and run npm install

digaus avatar Dec 22 '19 13:12 digaus

@digaus

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?

angelofan avatar Dec 23 '19 00:12 angelofan

@digaus

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.

digaus avatar Dec 23 '19 01:12 digaus

Is anyone having any issues connecting to a network in iOS 13.3+?

arsenal942 avatar Dec 23 '19 01:12 arsenal942

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

digaus avatar Dec 23 '19 01:12 digaus

Does anyone have found the solution to this problem. I am still getting Not Found on iOS 13.3

jainsuneet avatar Jan 29 '20 13:01 jainsuneet

Same here. Anything new on this issue?

zabojad avatar Feb 06 '20 16:02 zabojad

@zabojad Is your system version also iOS 13.1.3?

angelofan avatar Feb 06 '20 16:02 angelofan

@arsenal942 @digaus

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?

HusFNS avatar Apr 06 '20 14:04 HusFNS

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

andreareidel avatar Jul 02 '20 09:07 andreareidel

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

angelofan avatar Jul 07 '20 07:07 angelofan

there is already a fix available for this in the @digaus fork.

HusFNS avatar Jul 07 '20 07:07 HusFNS

@HusFNS

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?

angelofan avatar Jul 07 '20 07:07 angelofan

@angelofan

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

HusFNS avatar Jul 07 '20 07:07 HusFNS

@HusFNS

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 ?

angelofan avatar Jul 07 '20 08:07 angelofan

@HusFNS

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

andreareidel avatar Jul 07 '20 08:07 andreareidel

@angelofan

I will test this on ios 14 I am using 13

HusFNS avatar Jul 07 '20 09:07 HusFNS

Is there a PR containing the fixes from the fork another user did? If so, I will review and merge accordingly.

On Tue, 7 Jul 2020 at 7:17 pm, Angelo Fan [email protected] wrote:

@HusFNS https://github.com/HusFNS OK

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tripflex/WifiWizard2/issues/95#issuecomment-654717294, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADO6DHCGHTSKRMRHJEAGOMLR2LR2PANCNFSM4JBTIX6Q .

-- Regards, Nicholas Clancy Technical Director & Partner Inline images 0420 634 180 or +61 420 634 180 [email protected] Norwest Business Park, Bella Vista, NSW, 2153, Australia www.viscreate.com.a

arsenal942 avatar Jul 07 '20 11:07 arsenal942

@arsenal942 @tripflex

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.

image

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: https://github.com/dpa99c/cordova-diagnostic-plugin/issues/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 new requestTemporaryFullAccuracyAuthorization() method. This requires the user to authorise full accuracy each time you need it via a new authorisation prompt which displays the new NSLocationTemporaryUsageDescriptionDictionary plist key. The current accuracy level is indicated by the accuracyAuthorization property of CLLocationManager as CLAccuracyAuthorization 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.

angelofan avatar Jul 08 '20 06:07 angelofan

Has this issue been resolved?

angelofan avatar Oct 18 '21 03:10 angelofan

iPhone 13pro,IOS 15.4.1,use getCurrentPosition() return "Not available",can you help solve this problem?

cf1991 avatar Jun 28 '22 04:06 cf1991