Discovers the specified services of the peripheral.
SDKs
- iOS 5.0+
- macOS 10.7+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 4.0+
Framework
- Core Bluetooth
Declaration
Parameters
serviceUUIDs
Discussion
You can provide an array of CBUUID
objects—representing service UUIDs—in the service
parameter. When you do, the peripheral returns only the services of the peripheral that match the provided UUIDs.
Note
If the services
parameter is nil
, this method returns all of the peripheral’s available services. This is much slower than providing an array of service UUIDs to search for.
When the peripheral discovers one or more services, it calls the peripheral:
: method of its delegate object. After a peripheral discovers services, you can access them through the peripheral’s services
property.