<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreBluetooth",
  "identifier" : "/documentation/CoreBluetooth/CBCentralManager/scanForPeripherals(withServices:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Bluetooth"
    ],
    "preciseIdentifier" : "c:objc(cs)CBCentralManager(im)scanForPeripheralsWithServices:options:"
  },
  "title" : "scanForPeripherals(withServices:options:)"
}
-->

# scanForPeripherals(withServices:options:)

Scans for peripherals that are advertising services.

```
func scanForPeripherals(withServices serviceUUIDs: [CBUUID]?, options: [String : Any]? = nil)
```

## Parameters

`serviceUUIDs`

An array of [`CBUUID`](/documentation/CoreBluetooth/CBUUID) objects that the app is interested in. Each [`CBUUID`](/documentation/CoreBluetooth/CBUUID) object represents the UUID of a service that a peripheral advertises.

`options`

A dictionary of options for customizing the scan. For available options, see [Peripheral Scanning Options](/documentation/CoreBluetooth/peripheral-scanning-options).

## Discussion

You can provide an array of [`CBUUID`](/documentation/CoreBluetooth/CBUUID) objects — representing service UUIDs — in the `serviceUUIDs` parameter. When you do, the central manager returns only peripherals that advertise the services you specify. If the `serviceUUIDs` parameter is `nil`, this method returns all discovered peripherals, regardless of their supported services.

> Note:
> The recommended practice is to populate the `serviceUUIDs` parameter rather than leaving it `nil`.

If the central manager is actively scanning with one set of parameters and it receives another set to scan, the new parameters override the previous set. When the central manager discovers a peripheral, it calls the [`centralManager(_:didDiscover:advertisementData:rssi:)`](/documentation/CoreBluetooth/CBCentralManagerDelegate/centralManager(_:didDiscover:advertisementData:rssi:)) method of its delegate object.

Your app can scan for Bluetooth devices in the background by specifying the `bluetooth-central` background mode. To do this, your app must explicitly scan for one or more services by specifying them in the `serviceUUIDs` parameter. The [`CBCentralManager`](/documentation/CoreBluetooth/CBCentralManager) scan option has no effect while scanning in the background.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)