Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this plugin seems to be broken in IOS 13.0 beta (getCurrentSSID returns unknown) #88

Open
nielsoo opened this issue Jun 20, 2019 · 20 comments

Comments

@nielsoo
Copy link

nielsoo commented Jun 20, 2019

same functionality works flawless in the latest IOS 12

@tripflex
Copy link
Owner

Thanks for reporting this, does anybody have any insight into why this may be in iOS 13.0+?

@ConPor
Copy link

ConPor commented Jul 11, 2019

same issue, Xcode debugs logs:

[6077:1095709] Supported interfaces: (
en0
)
[6077:1095709] [] nehelper sent invalid result code [1] for Wi-Fi information request
[6077:1095709] en0 => (null)
[6077:1095709] THREAD WARNING: ['WifiWizard2'] took '41.750977' ms. Plugin should use a background thread.
[6077:1095709] ERROR: Unable to get connected wifi ssid Not available

I think it's a permission issue on iOS 13:

Check out WWDC 19 session 713, Advances in Networking, Part 2 (maybe 75% of the way through the presentation). CNCopyCurrentNetworkInfo is now only available to your app in three cases:

Apps with permission to access location
Your app is the currently enabled VPN app
Your app configured the WiFi network the device is currently using via NEHotspotConfiguration

source

@nielsoo
Copy link
Author

nielsoo commented Aug 1, 2019

Hi, I added the location permission manually by installing another plugin that needs the location (cordova-plugin-geolocation) and that fixed it!

@almadomus
Copy link

Just received from apple:

Dear $firstName,

As we announced at WWDC19, we're making changes to further protect user privacy and prevent unauthorized location tracking. Starting with iOS 13, the CNCopyCurrentNetworkInfo API will no longer return valid Wi-Fi SSID and BSSID information. Instead, the information returned by default will be:

SSID: “Wi-Fi” or “WLAN” (“WLAN" will be returned for the China SKU)
BSSID: "00:00:00:00:00:00"

If your app is using this API, we encourage you to adopt alternative approaches that don’t require Wi-Fi or network information. Valid SSID and BSSID information from CNCopyCurrentNetworkInfo will still be provided to VPN apps, apps that have used NEHotspotConfiguration to configure the current Wi-Fi network, and apps that have obtained permission to access user location through Location Services.

Test your app on the latest iOS 13 beta to make sure it works properly. If your app requires valid Wi-Fi SSID and BSSID information to function, you can do the following:
For accessory setup apps, use the NEHotSpotConfiguration API, which now has the option to pass a prefix of the SSID hotspot your app expects to connect to.
For other types of apps, use the CoreLocation API to request the user’s consent to access location information.

Learn more by reading the updated documentation or viewing the the Advances in Networking session video from WWDC19. You can also submit a TSI for code-level support.

@arsenal942
Copy link
Collaborator

Apple really don’t help developers out here. I will update the plugin with a fix shortly otherwise it will require you as the user to implement a polling mechanism which checks if you’re still connected to your IoT device. I imagine this would involve polling a local endpoint on the connected device and checking if that resolves or not.

@almadomus
Copy link

Thanks. For most iot device maybe the solution suggested by Apple is OK (passing a prefix of ssid created by device) but different from what currently your plugin is doing.

@awaism551
Copy link

@arsenal942 Please let us know in which version of this plugin this ios13 issue is resolved, I also received the same email from apple regarding their policy change as shown by @almadomus.
Yes there is an option of using some external plugin to grant access but it would be great if this thing will be included in this awesome plugin aswell

@Giaco90
Copy link

Giaco90 commented Sep 24, 2019

I had the same problem and found this solution working for me:

https://juejin.im/post/5d4d1478f265da03e921b7de (google translate it)

The solution seems to be to check and force the permission request by means of the CoreLocationManager in the "fetchSSIDInfo".

@studiostart
Copy link

Hello, I had the same problem in my home automation app, which needed the SSID string.
In IOS 13, getCurrentSSID method stopped working.
I resolved installing the cordova-plugin-geolocation and using its getCurrentPosition method just to rise the ios authorization alert. After confirmed the authorization, wifiwizard started to work as espected.

@VijayVaveHealth
Copy link

VijayVaveHealth commented Oct 9, 2019

I was on iOS 13.0 and installed the cordova-plugin-geolocation and called getCurrentPosition to ask for location permission seems to have worked for like a week, but then it stopped working. Anyone else run into this issue on iOS 13.1.2.

@angelofan
Copy link

Is it possible to do something in order to be compatible with devices with version numbers ios13+ and android 8.1+?

  • Check if the permission to call the location is obtained
  • If not, a prompt box will pop up for the user to authorize

If you don't do this, everyone needs to make this judgment in their code when using the plugin.

@digaus
Copy link

digaus commented Dec 22, 2019

Is it possible to do something in order to be compatible with devices with version numbers ios13+ and android 8.1+?

  • Check if the permission to call the location is obtained
  • If not, a prompt box will pop up for the user to authorize

If you don't do this, everyone needs to make this judgment in their code when using the plugin.

Here is a fix if anyone wants to test it:

digaus@061b681

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

@ttthub
Copy link

ttthub commented Jan 8, 2020

Is it possible to do something in order to be compatible with devices with version numbers ios13+ and android 8.1+?

  • Check if the permission to call the location is obtained
  • If not, a prompt box will pop up for the user to authorize

If you don't do this, everyone needs to make this judgment in their code when using the plugin.

Here is a fix if anyone wants to test it:

digaus@061b681

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

Tried this on iphone 11, and the app fails to launch with this error:

This app has attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an “NSLocationWhenInUseUsageDescription” key with a string value explaining to the user how the app uses this data.

@angelofan
Copy link

@ttthub @digaus
iOS Quirks
Since iOS 10 it's mandatory to provide an usage description in the info.plist if trying to access privacy-sensitive data. When the system prompts the user to allow access, this usage description string will displayed as part of the permission dialog box, but if you didn't provide the usage description, the app will crash before showing the dialog. Also, Apple will reject apps that access private data but don't provide an usage description.

This plugins requires the following usage description:

NSLocationWhenInUseUsageDescription describes the reason that the app accesses the user's location.
To add this entry into the info.plist, you can use the edit-config tag in the config.xml like this:

<edit-config target="NSLocationWhenInUseUsageDescription" file="*-Info.plist" mode="merge">
    <string>need location access to find things nearby</string>
</edit-config>

Just like other plugins that auto-write config.xml to be automatically added to info.plist at compile time, this plugin should automatically write this code to config.xml during installation.

Here are some references:
https://errorsandmore.wordpress.com/2018/01/04/ionic-3-geolocation-not-working-on-ios-error/
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-geolocation/#ios-quirks

@digaus
Copy link

digaus commented Jan 8, 2020

Yes should have mentioned that. I switched to capacitor and created a WiFi plugin there.

@ttthub
Copy link

ttthub commented Jan 8, 2020

I can confirm that it has worked for me on iOS 13.3 after adding the config manually.

However, it does not detect the wifi details on iOS 13.2.3 (dont know about other versions)

@angelofan
Copy link

angelofan commented Jan 9, 2020

I can confirm that it has worked for me on iOS 13.3 after adding the config manually.

However, it does not detect the wifi details on iOS 13.2.3 (dont know about other versions)

@ttthub Seems to be a bug in iOS: #95

@arsenal942
Copy link
Collaborator

Is it possible to do something in order to be compatible with devices with version numbers ios13+ and android 8.1+?

  • Check if the permission to call the location is obtained
  • If not, a prompt box will pop up for the user to authorize

If you don't do this, everyone needs to make this judgment in their code when using the plugin.

Here is a fix if anyone wants to test it:

digaus@061b681

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

What changes did you make and if you can, submit a PR and I will review it.

@digaus
Copy link

digaus commented Jan 10, 2020

Is it possible to do something in order to be compatible with devices with version numbers ios13+ and android 8.1+?

  • Check if the permission to call the location is obtained
  • If not, a prompt box will pop up for the user to authorize

If you don't do this, everyone needs to make this judgment in their code when using the plugin.

Here is a fix if anyone wants to test it:
digaus@061b681
Just add
"cordova-plugin-wifiwizard2": "git+ssh://[email protected]/digaus/WifiWizard2.git#master"
to package.json and run npm install

What changes did you make and if you can, submit a PR and I will review it.

You can see the changes in the link. :) Currently busy with my application. Created my own Ionic Capacitor WiFi Plugin for better integration in my project.

If I find the time I can make a PR

@angelofan
Copy link

Any progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests