# 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="https://38998153-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCL8wF0y1T2vLnm3yR2MW%2Fuploads%2FcVRqjZMkvSkWUGmGAIYT%2FtechnicalGuides_isPushOptInTrue_100625.png?alt=media&#x26;token=d69b32a3-1284-4698-ae48-edf2fceae228" 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 %}
