<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ContactsUI",
  "identifier" : "/documentation/ContactsUI/ContactAccessButton/init(queryString:ignoredEmails:ignoredPhoneNumbers:approvalCallback:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Contacts UI"
    ],
    "preciseIdentifier" : "s:10ContactsUI19ContactAccessButtonV11queryString13ignoredEmails0H12PhoneNumbers16approvalCallbackACSS_ShySSGSgAIySaySSGcSgtcfc"
  },
  "title" : "init(queryString:ignoredEmails:ignoredPhoneNumbers:approvalCallback:)"
}
-->

# init(queryString:ignoredEmails:ignoredPhoneNumbers:approvalCallback:)

Creates a contact access button to quickly add contacts under limited-access
authorization.

```
@MainActor @preconcurrency init(queryString query: String, ignoredEmails: Set<String>? = nil, ignoredPhoneNumbers: Set<String>? = nil, approvalCallback: (([String]) -> Void)? = nil)
```

## Parameters

`query`

A string to match against contacts not yet exposed to the app.
You typically get this value from a search UI that your app presents, like a
text field.

`ignoredEmails`

A set of email addresses, as string values. The search omits
contacts matching `query` that also match any email address in this set.

`ignoredPhoneNumbers`

A set of phone numbers, as string values. The search
omits contacts matching `query` that also match any phone number in this set.

`approvalCallback`

A closure invoked when a person taps the button and adds
one or more contacts to the app. The parameter to the closure is an array of
contact identifiers, as strings.

## Discussion

This button uses the `query` string to match contacts that the person hasn’t yet
exposed to your app. If a single contact matches the search criteria, the button
presents that contact and adds it to the limited-access set when tapped. If
multiple contacts match, tapping the button navigates to another view where the
person can choose contacts to add.

---

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)