iOS BLE "unrecognized method" ScanForService & ConnectWithAddress

(This is probably just an FYI because I know iOS BLE is still a work in progress.)
I'm using iOS Companion Version 2.64.6 (build 16). I love that BLE is beginning to work! :heart:

The ScanForService block is not working on iOS but does work on Android. With this code, I get an error with the iOS companion:

Runtime Error
unrecognized method. Irritants: (ScanForService)

I want to use it to filter out all the non-relevant Bluetooth devices in a high school classroom. :iphone: :selfie: :iphone: :selfie: :iphone: :selfie: :iphone: :selfie: :iphone: :selfie:

Similarly, the ConnectWithAddress block is not working on iOS. With this code, I get an error with the iOS companion:


Runtime Error
unrecognized method. Irritants: (ConnectWithAddress)

Yes, we have only implemented a limited subset of functionality in this pass. It should be enough to do our most recently published tutorials with the micro:bit, but beyond that there is still a lot to implement.

Something important I will point out is that on iOS the ConnectWithAddress block will be fairly limited in its application compared with Android. On iOS, devices are assigned UUIDs specific to the host machine and the app cannot use MAC addresses to query for devices. This means that students on different devices will not see the same identifier, and you won't be able to say "connect to MAC 12:34:56:78:90:AB" as it will be meaningless on iOS.

1 Like

Interesting.

My use case: I am separating the BLE scanning UI & logic onto a separate Screen and passing the MAC address of which device to connect to as the startvalue. It sounds like this would still be doable, no?

(I would prefer to also handle the connection handshaking on my 'scanning' screen, but there is no way to pass an active BLE connection to another screen, is there?)

If you think of it as an opaque identifier rather than specifically a MAC address, then yes. However, it would not work to take a MAC address you detect on Android (or another iOS device), for example, and reuse it on iOS. Since it sounds like you're only using the address for the duration of the session on a single device, that should be safe.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.