NordicSemiconductor / IOS-CoreBluetooth-Mock

Mocking library for CoreBluetooth framework.
BSD 3-Clause "New" or "Revised" License
225 stars 51 forks source link

peripheral.discoverServices with empty list [] #68

Closed kscheff closed 1 year ago

kscheff commented 2 years ago

When using the mock the call to .discoverServices returns with am empty list.

Expected: the call should return all mockServices when supplying an empty list ([]).

Documentation to this call from Apple states:

Discussion

You can provide an array of CBUUID objects — representing service UUIDs — in the serviceUUIDs parameter. When you do, the peripheral returns only the services of the peripheral that match the provided UUIDs.

philips77 commented 1 year ago

Shouldn't you pass nil instead of [] to get all services?

kscheff commented 1 year ago

The goal was to have it compatible to CoreBluetooth with minimal changes. CB takes an empty list [] as input and delivers an unfiltered result.

philips77 commented 1 year ago

I confirm. An empty [] list behaves the same way as nil. I did not know that. Thanks for reporting.