flutter_blue icon indicating copy to clipboard operation
flutter_blue copied to clipboard

PlatformException (PlatformException(connect, Peripheral not found, null, null))

Open joankabello opened this issue 4 years ago • 5 comments

Hello,

I am using the plugin on an iOS 14 and this exception occurs when i kill the app and open it again. Did anyone found a workaround? I tried different workarounds in different issues and PR's that are not merged but it didn't fixed the problem.

Looks like a reinitialisation problem on Objective-C side when the app tries to find a Peripheral.

joankabello avatar Oct 19 '20 13:10 joankabello

A workaround for this issue that i used on iOS devices.

If Platform.IsiOS, just make a scan with 2 seconds timeout and then use stopScan().

This happens because iOS doesn't save the connected devices list when the phone disconnects so the connect() will fail since the connected devices list is empty.

joankabello avatar Oct 20 '20 19:10 joankabello

Hey, I saw that you created a fork of this library. When do you call the code to re-initialize?

LEMUSADR000 avatar Mar 03 '21 19:03 LEMUSADR000

Hey, I call the reinitialize method on my code, before the scan.

This is the link to the code that i added for the re-initialization on the forked repo. https://github.com/joankabello/flutter_blue/commit/70d77e7a295dde30a04765129983d2cff8aba3bb#diff-982e71202439d745e0d99cb29f213e29b587588b52fa929763de141d75b6df68R30

joankabello avatar Mar 04 '21 09:03 joankabello

Hi @joankabello ,

Was this issue resolved fro you?

Thanks

vaibhiarora03 avatar Jan 22 '22 12:01 vaibhiarora03

Please follow the below link the I have already answered to this question

https://github.com/pauldemarco/flutter_blue/issues/497#issuecomment-1805815352

JastySaran avatar Nov 11 '23 04:11 JastySaran