<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKUserAnnotatedMedicationQuery/init(predicate:limit:resultsHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKUserAnnotatedMedicationQuery(im)initWithPredicate:limit:resultsHandler:"
  },
  "title" : "init(predicate:limit:resultsHandler:)"
}
-->

# init(predicate:limit:resultsHandler:)

```
init(predicate: NSPredicate?, limit: Int, resultsHandler: @escaping (HKUserAnnotatedMedicationQuery, HKUserAnnotatedMedication?, Bool, (any Error)?) -> Void)
```

## Parameters

`predicate`

The predicate which user annotated medications should match.

`limit`

The maximum number of  user annotated medications to return.  Pass HKObjectQueryNoLimit for no limit.

`resultsHandler`

The block to invoke with results to deliver to the client. The results handler will be called with done = YES when there are no more user annotated medications to enumerate.

## Discussion

\abstract Returns a query that will retrieve HKUserAnnotatedMedications matching the given predicate and limit.

---

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)