Scans for peripherals that are advertising services.
- iOS 5.0+
- macOS 10.7+
- tvOS 9.0+
- watchOS 4.0+
- Core Bluetooth
An optional dictionary specifying options to customize the scan. For available options, see Peripheral Scanning Options.
You can provide an array of
CBUUID objects—representing service UUIDs—in the
service parameter. When you do, the central manager returns only peripherals that advertise the services you specify (recommended). If the
service parameter is
nil, all discovered peripherals are returned regardless of their supported services (not recommended). If the central manager is already scanning with different parameters, the provided parameters replace them. When the central manager object discovers a peripheral, it calls the
central method of its delegate object.
Apps that have specified the
bluetooth-central background mode are allowed to scan while in the background. That said, they must explicitly scan for one or more services by specifying them in the
service parameter. The
CBCentral scan option is ignored while scanning in the background.