# How to allow users to unsubscribe from push notifications on iOS?

## 1. Redirect users to the phone's settings <a href="#id-1-redirect-users-to-the-phones-settings" id="id-1-redirect-users-to-the-phones-settings"></a>

On iOS, redirecting users to the phone's settings is the only 100% reliable way to disable push notifications.

You can use the `[BatchPush openSystemNotificationSettings]` (Objective C) or the `BatchPush.openSystemNotificationSettings()` (Swift) method.

{% hint style="warning" %}
You can implement a toggle switch that directs users to the system settings when clicked, allowing them to disable or enable push notifications. To get the right toggle switch state, use [the following method](https://developer.apple.com/documentation/usernotifications/unusernotificationcenter/1649527-requestauthorizationwithoptions?language=objc).
{% endhint %}

## 2. Take advantage of Batch's segmentation engine  <a href="#id-2-take-advantage-of-batchs-segmentation-engine" id="id-2-take-advantage-of-batchs-segmentation-engine"></a>

However, some apps offer the option to disable push notifications directly within the app.

### A. Tag users' optin status <a href="#a-tag-users-optin-status" id="a-tag-users-optin-status"></a>

Create a boolean `is_push_optin` attribute, `true` when users have activated push notifications in the app's settings, `false` when they have disabled them.

### B. Use this attribute in all your campaign's segmentation <a href="#b-use-this-attribute-in-all-your-campaigns-segmentation" id="b-use-this-attribute-in-all-your-campaigns-segmentation"></a>

Whenever you create a campaign, include this attribute in your targeting.&#x20;

<figure><img src="/files/AB6IuNanckd1YI2geyGk" alt="Segmentation rule for &#x22;is_push_optin&#x22; set to &#x22;is equal to Yes&#x22; in Batch dashboard."><figcaption></figcaption></figure>

{% hint style="danger" %}
Before you choose to use this method, please consider the following points:&#x20;

* This method is network-dependent. If users are not connected to the Internet, the push notifications' disabling will not be immediate.
* It can be a source of errors. If you forget to include the attribute in your targeting, you will send notifications to users who indicated they don't want to receive push notifications.&#x20;
  {% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.batch.com/developer/technical-guides/how-to-guides/mobile/ios-specific/how-to-allow-users-to-unsubscribe-from-push-notifications-on-ios.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
