universal_ble icon indicating copy to clipboard operation
universal_ble copied to clipboard

BLE Scanning Issue on iOS

Open alessandrodestefani opened this issue 1 year ago • 2 comments

I have trouble making the scanning work on IOS, i can't get any event on the scanning callback. The same code on Android and Windows is working perfectly. I have added the permission in the info.plist.

The code:

UniversalBle.onScanResult = (event) { debugPrint("item found!"); }; await UniversalBle.startScan();

There is something that i am missing?

alessandrodestefani avatar Aug 02 '24 12:08 alessandrodestefani

@alessandrodestefani have you tried example app ?

rohitsangwan01 avatar Aug 02 '24 16:08 rohitsangwan01

Ok, i have tried an empty project and also the example app. I have found out that on IOS if you don't set UniversalBle.onAvailabilityChange = (state) {}; the first commend startScan will not fire (the global queue will register it and will empty), the second time it will work.

If you have set onAvailabilityChange it will work fine.

alessandrodestefani avatar Aug 05 '24 08:08 alessandrodestefani

@alessandrodestefani please try with this PR

rohitsangwan01 avatar Dec 04 '24 11:12 rohitsangwan01

Released in 0.14.0

fotiDim avatar Dec 09 '24 16:12 fotiDim