<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMotion",
  "identifier" : "/documentation/CoreMotion/CMMotionManager/startMagnetometerUpdates(to:withHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Motion"
    ],
    "preciseIdentifier" : "c:objc(cs)CMMotionManager(im)startMagnetometerUpdatesToQueue:withHandler:"
  },
  "title" : "startMagnetometerUpdates(to:withHandler:)"
}
-->

# startMagnetometerUpdates(to:withHandler:)

Starts magnetometer updates on an operation queue and with a specified handler.

```
func startMagnetometerUpdates(to queue: OperationQueue, withHandler handler: @escaping CMMagnetometerHandler)
```

## Parameters

`queue`

An operation queue provided by the caller. Because the processed events might arrive at a high rate, using the main operation queue is not recommended.

`handler`

A block that is invoked with each update to handle new magnetometer data. The block must conform to the [`CMMagnetometerHandler`](/documentation/CoreMotion/CMMagnetometerHandler) type.

## Discussion

You must call [`stopMagnetometerUpdates()`](/documentation/CoreMotion/CMMotionManager/stopMagnetometerUpdates()) when you no longer want your app to process magnetometer updates.

---

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)