flutternetwork / WiFiFlutter

Flutter plugin suite for various WiFi services.
https://wifi.flutternetwork.dev
290 stars 182 forks source link

MissingPluginException on iOS #33

Closed R1cs1KING closed 4 years ago

R1cs1KING commented 5 years ago

Hi all! I have encountered an issue when I am trying to connect to WiFi on iOS (on Android it works). This is the error I get:

flutter: MissingPluginException : MissingPluginException(No implementation found for method setEnabled on channel wifi_iot)

And this is the code I am using to connect: WiFiForIoTPlugin.connect(ssid, password: password, security: NetworkSecurity.WPA);

Thanks for your help in advance!

R1cs1KING commented 5 years ago

I am not sure about it, but I am not sure about in SwiftWifiIotPlugin.swift this method: private func setEnabled(call: FlutterMethodCall, result: FlutterResult) { let arguments = call.arguments let state = (arguments as! [String : Bool])["state"] if (state != nil) { print("Setting WiFi Enable : \(((state ?? false) ? "enable" : "disable"))") result(FlutterMethodNotImplemented) } else { result(nil) } } should result FlutterMethodNotImplemented in the first case.

Niek commented 5 years ago

Same problem here, connect() calls setEnabled(true) which causes this issue. What is the best fix? I assume setEnabled(true) shouldn't be called on iOS?

daadu commented 4 years ago

I have added PR #65 that does what @Niek mentioned. It solves the problem for me.

@Niek @R1cs1KING Please confirm by using my fork repo to test (check below snippet to do that) so that it can be merged.

dependencies:
  flutter:
    sdk: flutter
  ...
  wifi_iot: #^0.1.1
    git:
      url: https://github.com/daadu/WiFiFlutter.git
Niek commented 4 years ago

Yep that's the fix @daadu

daadu commented 4 years ago

@alternadom Please merge.

BenoitDuffez commented 3 years ago

I still have this problem on iOS14 emulator. The fix is present. What's wrong?

Edit: actually the message is different

MissingPluginException(No implementation found for method loadWifiList on channel wifi_iot)

Found this:

private func loadWifiList(result: FlutterResult) {
    result(FlutterMethodNotImplemented)
}
daadu commented 3 years ago

sacn and getting wifi list is not possible in iOS (AFAIK)

BenoitDuffez commented 3 years ago

Yes indeed, as I found out after posting. This baffles me but I'll find another way. Thanks for confirming!

pyon123 commented 3 years ago

I also have a problem. I am trying to connect wifi on iOS phone using wifi_iot library.

WiFiForIoTPlugin.connect(ssid, password: password, security: NetworkSecurity.WPA);

There is no MissingPluginException and it doesn't seem to publish any error.

But I can't connect to other wifi with my Phone. (Android works fine.) it returns always false.

Is there anyone to solve this issue?

image_2021_05_16T10_49_51_895Z

daadu commented 3 years ago

@pyon123 Did you add proper entitlements (this part is missing in README) - Hotspot Configuration and Access WiFi Information ?

pyon123 commented 3 years ago

@daadu Thanks for your kind reply. I am not sure I configure it successfully. This is all what I do. image

it is working fine in Android 9.0. But not working iOS. My iOS version is 12.5.3. I made ESP32 device as an access point and trying to connect to that device with my phone. So no need to Hotspot configuration on my phone. Just want to access the device.

Please let me know your answer.

PS: Here is my project repository. (master branch). it is just simple for a testing. https://github.com/pyon123/ap_img_transfer_flutter

daadu commented 3 years ago

@pyon123 "Hotspot" in iOS is not "Accesspoint (Hotspot) in WLAN", is the underlying library name, that the package uses.

Additional setups, that are not documented in README, are as following, please follow them and let me know if it works.

Screenshot from 2021-05-16 20-39-11

ngmduc2012 commented 2 years ago
Screen Shot 2022-04-21 at 17 42 23

It works for me. i added 3 them

selcuksenel commented 6 months ago

I think the plugin no longer works on iOS.(flutter: Cannot get scanned results: CanGetScannedResults.notSupported) When I run the wifi scan sample code, I encounter such a message. You should update the documents, you are causing a lot of people to waste their time this way sir!!