---
source_url: https://www.pubnub.com/docs/sdks/cocoa-objective-c/api-reference/mobile-push
title: Mobile Push Notifications API for Cocoa Objective-C SDK
updated_at: 2026-05-27T17:01:58.117Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Mobile Push Notifications API for Cocoa Objective-C SDK

The Mobile Push Notifications feature connects native PubNub publishing to third-party push services. Supported services include Google Android FCM (Firebase Cloud Messaging) and Apple iOS APNs (Apple Push Notification service).

To learn more, read about [Mobile Push Notifications](https://www.pubnub.com/docs/general/push/send).

## Add a device to a push notifications channel

:::note Requires Mobile Push Notifications add-on
Enable Mobile Push Notifications for your key in the [Admin Portal](https://admin.pubnub.com/). See how to [enable add-on features](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-).
:::

Enable mobile push notifications on a set of channels.

### Method(s)

To run `Adding Device to Channel` you can use the following method(s) in the Cocoa SDK:

```objectivec
- (void)addPushNotificationsOnChannels:(NSArray<NSString *> *)channels
                   withDevicePushToken:(NSData *)pushToken
                         andCompletion:(nullable PNPushNotificationsStateModificationCompletionBlock)block;
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| channels | NSArray | Yes |  | Channels to enable for push notifications. |
| pushToken | NSData | Yes |  | Device push token. |
| block | PNPushNotificationsStateModificationCompletionBlock | Optional |  | Completion block with request status. |

```objectivec
- (void)addPushNotificationsOnChannels:(NSArray<NSString *> *)channels
                   withDevicePushToken:(id)pushToken
                              pushType:(PNPushType)pushType
                         andCompletion:(nullable PNPushNotificationsStateModificationCompletionBlock)block;
```

| Parameter | Description |
| --- | --- |
| `channels` *Type: NSArray`<NSString *>` * | Channels to enable for push notifications. |
| `pushToken` *Type: id | Device token (`NSData` for APNS/APNS2, `NSString` otherwise). |
| `pushType` *Type: PNPushType | One of: `PNAPNSPush`, `PNAPNS2Push`, `PNFCMPush`, `PNMPNSPush`. |
| `block`Type: PNPushNotificationsStateModificationCompletionBlock | Completion block. |

```objectivec
- (void)addPushNotificationsOnChannels:(NSArray<NSString *> *)channels
                   withDevicePushToken:(id)pushToken
                              pushType:(PNPushType)pushType
                           environment:(PNAPNSEnvironment)environment
                                 topic:(NSString *)topic
                         andCompletion:(nullable PNPushNotificationsStateModificationCompletionBlock)block;
```

| Parameter | Description |
| --- | --- |
| `channels` *Type: NSArray`<NSString *>` | Channels to enable for push notifications. |
| `pushToken` *Type: id | Device token (`NSData` for APNS/APNS2, `NSString` otherwise). |
| `pushType` *Type: PNPushType | One of: `PNAPNSPush`, `PNAPNS2Push`, `PNFCMPush`, `PNMPNSPush`. |
| `environment` *Type: PNAPNSEnvironment | APNs environment. |
| `topic` *Type: NSString | APNs topic (bundle identifier). |
| `block`Type: PNPushNotificationsStateModificationCompletionBlock | Completion block. |

### Sample code

#### Add device to channel

```objectivec
[self.client addPushNotificationsOnChannels:@[@"wwdc",@"google.io"]
                        withDevicePushToken:self.devicePushToken
                              andCompletion:^(PNAcknowledgmentStatus *status) {

    if (!status.isError) {

    // Handle successful push notification enabling on passed channels.
    }
    else {

        /**
         Handle modification error. Check 'category' property
         to find out possible reason because of which request did fail.
         Review 'errorData' property (which has PNErrorData data type) of status
         object to get additional information about issue.

         Request can be resent using: [status retry];
         */
    }
}];
```

### Response

Response objects which is returned by client when APNS Add Device API is used:

```objectivec
@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end

@interface PNAcknowledgmentStatus : PNErrorStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end
```

### Other examples

#### Example for method no. 2

```objectivec
[self.client addPushNotificationsOnChannels:@[@"wwdc",@"google.io"]
                        withDevicePushToken:self.devicePushToken
                                    pushType:PNAPNSPush
                                andCompletion:^(PNAcknowledgmentStatus *status) {

    if (!status.isError) {
        // Push notifications successful enabled on passed channels.
    } else {
        /**
            * Handle modification error. Check 'category' property to find out possible issue because
            * of which request did fail.
            *
            * Request can be resent using: [status retry];
            */
    }
}];
```

#### Example for method no. 3

```objectivec
[self.client addPushNotificationsOnChannels:@[@"wwdc",@"google.io"]
                        withDevicePushToken:self.devicePushToken
                                    pushType:PNAPNS2Push
                                environment:PNAPNSProduction
                                        topic:@"com.my-application.bundle"
                                andCompletion:^(PNAcknowledgmentStatus *status) {

    if (!status.isError) {
        // Push notifications successful enabled on passed channels.
    } else {
        /**
            * Handle modification error. Check 'category' property to find out possible issue because
            * of which request did fail.
            *
            * Request can be resent using: [status retry];
            */
    }
}];
```

## Add device to channel (builder pattern)

:::note Requires Mobile Push Notifications add-on
This method requires that the Mobile Push Notifications add-on is enabled for your key in the [Admin Portal](https://admin.pubnub.com/). Read the [support page](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-) on enabling add-on features on your keys.
:::

Enable mobile push notifications on provided set of channels.

### Method(s)

To run `Adding Device to Channel` you can use the following method(s) in the Cocoa SDK

#### APNS2 token

```objectivec
push()
    .enable()
    .channels(NSArray<NSString *> *)
    .token(id)
    .pushType(PNPushType)
    .environment(PNAPNSEnvironment)
    .topic(NSString *)
    .performWithCompletion(nullable PNPushNotificationsStateModificationCompletionBlock);
```

| Parameter | Description |
| --- | --- |
| `channels` *Type: NSArray`<NSString *>` | Channels to enable for push notifications. |
| `token` *Type: id | Device token / identifier that you must set to `NSData`. |
| `pushType` *Type: PNPushType | One of: `PNAPNSPush`, `PNAPNS2Push`, `PNFCMPush`, `PNMPNSPush`. |
| `environment`Type: PNAPNSEnvironment | APNs environment. |
| `topic`Type: NSString | APNs topic (bundle identifier). |
| `block`Type: PNPushNotificationsStateModificationCompletionBlock | Completion block. |

:::note Optional arguments
This method uses the builder pattern, you can remove the arguments which are optional.
:::

#### FCM token

```objectivec
push()
    .enable()
    .fcmToken(NSString *)
    .channels(NSArray<NSString *> *)
    .performWithCompletion(nullable PNPushNotificationsStateModificationCompletionBlock);
```

| Parameter | Description |
| --- | --- |
| `channels` *Type: NSArray`<NSString *>` * | Channels to enable for push notifications. |
| `fcmToken` *Type: NSString * | FCM-provided device push token which should be used to enable mobile push notifications on a specified set of `channels`. |
| `completion`Type: PNPushNotificationsStateModificationCompletionBlock | Push notifications addition on `channels` processing `completion block` which pass only one argument - request processing status to report about how data pushing was successful or not. |

:::note Optional arguments
This method uses the builder pattern, you can remove the arguments which are optional.
:::

### Sample code

#### APNS2 token

```objectivec
self.client.push().enable()
    .token(self.devicePushToken)
    .channels(@[@"wwdc",@"google.io"])
    .pushType(PNAPNS2Push)
    .environment(PNAPNSProduction)
    .topic(@"com.my-application.bundle")
    .performWithCompletion(^(PNAcknowledgmentStatus *status) {
        if (!status.isError) {
            // Push notifications successful enabled on passed channels.
        } else {
            /**
             * Handle modification error. Check 'category' property to find out possible issue because
             * of which request did fail.
             *
             * Request can be resent using: [status retry];
             */
        }
    });
```

#### FCM token

```objectivec
self.client.push().enable()
    .token(self.devicePushToken)
    .channels(@[@"wwdc",@"google.io"])
    .pushType(PNFCMPush)
    .performWithCompletion(^(PNAcknowledgmentStatus *status) {
        if (!status.isError) {
            // Push notifications successful enabled on passed channels.
        } else {
            /**
             * Handle modification error. Check 'category' property to find out possible issue because
             * of which request did fail.
             *
             * Request can be resent using: [status retry];
             */
        }
    });
```

### Response

Response objects which is returned by client when `APNS Add Device` API is used:

```objectivec
@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end

@interface PNAcknowledgmentStatus : PNErrorStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end
```

## List channels for device

:::note Requires Mobile Push Notifications add-on
This method requires that the Mobile Push Notifications add-on is enabled for your key in the [Admin Portal](https://admin.pubnub.com/). Read the [support page](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-) on enabling add-on features on your keys.
:::

Request for all channels on which push notification has been enabled using specified pushToken.

### Method(s)

To run `Listing Channels For Device` you can use the following method(s) in the Cocoa SDK:

```objectivec
- (void)pushNotificationEnabledChannelsForDeviceWithPushToken:(NSData *)pushToken
                                                andCompletion:(PNPushNotificationsStateAuditCompletionBlock)block;
```

| Parameter | Description |
| --- | --- |
| `pushToken` *Type: NSData | Device push token against which search on PubNub service should be performed. |
| `block` *Type: PNPushNotificationsStateAuditCompletionBlock | Push `notifications` status processing completion `block` which pass two arguments: result - in case of successful request processing data field will contain results of push `notifications` audit operation; status - in case if error occurred during request processing. |

```objectivec
- (void)pushNotificationEnabledChannelsForDeviceWithPushToken:(id)pushToken
                                                     pushType:(PNPushType)pushType
                                                andCompletion:(PNPushNotificationsStateAuditCompletionBlock)block;
```

| Parameter | Description |
| --- | --- |
| `pushToken` *Type: id | Device token / identifier that you must set to `NSString`. |
| `pushType` *Type: PNPushType | One of: `PNFCMPush`. |
| `block` *Type: PNPushNotificationsStateAuditCompletionBlock | `Audit notifications enabled channels` request completion block. |

```objectivec
- (void)pushNotificationEnabledChannelsForDeviceWithPushToken:(id)pushToken
                                                     pushType:(PNPushType)pushType
                                                  environment:(PNAPNSEnvironment)environment
                                                        topic:(NSString *)topic
                                                andCompletion:(PNPushNotificationsStateAuditCompletionBlock)block;
```

| Parameter | Description |
| --- | --- |
| `pushToken` *Type: id | Device token / identifier that you must set to `NSData`. |
| `pushType` *Type: PNPushType | One of: `PNAPNS2Push`. |
| `environment` *Type: PNAPNSEnvironment | APNs environment. |
| `topic` *Type: NSString | APNs topic (bundle identifier). |
| `block` *Type: PNPushNotificationsStateAuditCompletionBlock | `Audit notifications enabled channels` request completion block. |

### Sample code

#### List channels for device

```objectivec
[self.client pushNotificationEnabledChannelsForDeviceWithPushToken:self.devicePushToken
                                                      andCompletion:^(PNAPNSEnabledChannelsResult *result,
                                                                      PNErrorStatus *status) {
      if (!status) {

        // Handle downloaded list of channels using: result.data.channels
    }
    else {

        /**
         Handle audition error. Check 'category' property
         to find out possible reason because of which request did fail.
         Review 'errorData' property (which has PNErrorData data type) of status
         object to get additional information about issue.

         Request can be resent using: [status retry];
         */
    }
 }];
```

### Response

Response objects which is returned by client`APNS List Devices` API is used:

```objectivec
@interface PNAPNSEnabledChannelsData : PNServiceData

// Channels with active mobile push notifications.
@property (nonatomic, readonly, strong) NSArray<NSString *> *channels;

@end

@interface PNAPNSEnabledChannelsResult : PNResult

// APNS enabled channels audit request processed information.
@property (nonatomic, readonly, strong) PNAPNSEnabledChannelsData *data;

@end
```

Error response which is used in case of `APNS List Devices` API call failure:

```objectivec
@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end

@interface PNErrorStatus : PNStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end
```

### Other examples

#### Example for method no. 2

```objectivec
[self.client pushNotificationEnabledChannelsForDeviceWithPushToken:self.devicePushToken
                            pushType:PNFCMPush
                    andCompletion:^(PNFCMEnabledChannelsResult *result, PNErrorStatus *status) {

    if (!status.isError) {
        // Handle downloaded list of channels using: result.data.channels
    } else {
        /**
            * Handle audition error. Check 'category' property to find out possible issue because of
            * which request did fail.
            *
            * Request can be resent using: [status retry];
            */
    }
}];
```

#### Example for method no. 3

```objectivec
[self.client pushNotificationEnabledChannelsForDeviceWithPushToken:self.devicePushToken
                            pushType:PNAPNS2Push
                        environment:PNAPNSDevelopment
                            topic:@"com.my-application.bundle"
                    andCompletion:^(PNAPNSEnabledChannelsResult *result, PNErrorStatus *status) {

    if (!status.isError) {
        // Handle downloaded list of channels using: result.data.channels
    } else {
        /**
            * Handle audition error. Check 'category' property to find out possible issue because of
            * which request did fail.
            *
            * Request can be resent using: [status retry];
            */
    }
}];
```

## List channels for device (builder pattern)

:::note Requires Mobile Push Notifications add-on
This method requires that the Mobile Push Notifications add-on is enabled for your key in the [Admin Portal](https://admin.pubnub.com/). Read the [support page](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-) on enabling add-on features on your keys.
:::

Request for all channels on which push notification has been enabled using specified pushToken.

### Method(s)

To run `Listing Channels For Device` you can use the following method(s) in the Cocoa SDK

#### APNS2 token

```objectivec
push()
    .audit()
    .token(id)
    .pushType(PNPushType)
    .environment(PNAPNSEnvironment)
    .topic(NSString *)
    .performWithCompletion(PNPushNotificationsStateAuditCompletionBlock);
```

| Parameter | Description |
| --- | --- |
| `token` *Type: id | Device token / identifier that you must set to `NSData`. |
| `pushType` *Type: PNPushType | One of: `PNFCMPush`. |
| `environment`Type: PNAPNSEnvironment | APNs environment. |
| `topic`Type: NSString | APNs topic (bundle identifier). |
| `block` *Type: PNPushNotificationsStateAuditCompletionBlock | `Audit notifications enabled channels` request completion block. |

:::note Optional arguments
This method uses the builder pattern, you can remove the arguments which are optional.
:::

#### FCM token

```objectivec
push()
    .audit()
    .fcmToken(NSString *)
    .performWithCompletion(PNPushNotificationsStateModificationCompletionBlock);
```

| Parameter | Description |
| --- | --- |
| `fcmToken` *Type: NSString * | FCM-provided device `push token` against which search on PubNub service should be performed. |
| `completion` *Type: PNPushNotificationsStateAuditCompletionBlock | Push `notifications` status processing completion `block` which pass two arguments: `result` - in case of successful request processing `data` field will contain results of push `notifications` audit operation; `status` - in case if error occurred during request processing. |

:::note Optional arguments
This method uses the builder pattern, you can remove the arguments which are optional.
:::

### Sample code

#### APNS2 token

```objectivec
self.client.push()
    .audit()
    .token(self.devicePushToken)
    .pushType(PNAPNS2Push)
    .environment(PNAPNSProduction)
    .topic(@"com.my-application.bundle")
    .performWithCompletion(^(PNAPNSEnabledChannelsResult *result, PNErrorStatus *status) {
        if (!status.isError) {
            // Handle downloaded list of channels using: result.data.channels
        } else {
            /**
                * Handle audition error. Check 'category' property to find out possible issue because of
                * which request did fail.
                *
                * Request can be resent using: [status retry];
                */
        }
    });
```

#### FCM token

```objectivec
self.client.push().audit()
    .fcmToken(self.pushToken)
    .performWithCompletion(^(PNAPNSEnabledChannelsResult *result, PNErrorStatus *status) {
        if (!status) {
            // Handle downloaded list of channels using: result.data.channels
        } else {
            /**
                Handle audition error. Check 'category' property
                to find out possible reason because of which request did fail.
                Review 'errorData' property (which has PNErrorData data type) of status
                object to get additional information about issue.

                Request can be resent using: [status retry];
            */
        }
    }];
```

### Response

Response objects which is returned by client when `APNS List Devices` API is used:

```objectivec
@interface PNAPNSEnabledChannelsData : PNServiceData

// Channels with active mobile push notifications.
@property (nonatomic, readonly, strong) NSArray<NSString *> *channels;

@end

@interface PNAPNSEnabledChannelsResult : PNResult

// APNS enabled channels audit request processed information.
@property (nonatomic, readonly, strong) PNAPNSEnabledChannelsData *data;

@end
```

Error response which is used in case of `APNS List Devices` API call failure:

```objectivec
@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end

@interface PNErrorStatus : PNStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end
```

## Remove device from channel

:::note Requires Mobile Push Notifications add-on
This method requires that the Mobile Push Notifications add-on is enabled for your key in the [Admin Portal](https://admin.pubnub.com/). Read the [support page](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-) on enabling add-on features on your keys.
:::

Disable mobile push notifications on provided set of channels.

### Method(s)

To run `Removing Device From Channel` you can use the following method(s) in the Cocoa SDK:

```objectivec
- (void)removePushNotificationsFromChannels:(NSArray<NSString *> *)channels
                        withDevicePushToken:(NSData *)pushToken
                              andCompletion:(nullable PNPushNotificationsStateModificationCompletionBlock)block;
```

| Parameter | Description |
| --- | --- |
| `channels` *Type: NSArray | List of channel names for which mobile push notifications should be disabled. `If passed list is empty all notifications will be disabled.` |
| `pushToken` *Type: NSData | Device push token which should be used to disable push `notifications` on specified set of `channels`. |
| `block`Type: PNPushNotificationsStateModificationCompletionBlock | Push `notifications` removal from `channels` processing completion `block` which pass only one argument - request processing `status` to report about how data pushing was successful or not. |

```objectivec
- (void)removePushNotificationsFromChannels:(NSArray<NSString *> *)channels
                        withDevicePushToken:(id)pushToken
                                   pushType:(PNPushType)pushType
                              andCompletion:(nullable PNPushNotificationsStateModificationCompletionBlock)block;
```

| Parameter | Description |
| --- | --- |
| `channels` *Type: NSArray`<NSString *>` * | List of channel names for which mobile push notifications should be disabled. |
| `pushToken` *Type: id | Device token / identifier that you must set to `NSString`. |
| `pushType` *Type: PNPushType | One of: `PNAPNS2Push`. |
| `block`Type: PNPushNotificationsStateModificationCompletionBlock | `Remove notifications from channels` request completion block. |

```objectivec
- (void)removePushNotificationsFromChannels:(NSArray<NSString *> *)channels
                        withDevicePushToken:(id)pushToken
                                   pushType:(PNPushType)pushType
                                environment:(PNAPNSEnvironment)environment
                                      topic:(NSString *)topic
                              andCompletion:(nullable PNPushNotificationsStateModificationCompletionBlock)block;
```

| Parameter | Description |
| --- | --- |
| `channels` *Type: NSArray`<NSString *>` * | List of channel names for which mobile push notifications should be disabled. |
| `pushToken` *Type: id | Device token / identifier that you must set to `NSData`. |
| `pushType` *Type: PNPushType | One of: `PNAPNS2Push`, `PNFCMPush`. |
| `environment` *Type: PNAPNSEnvironment | APNs environment. |
| `topic` *Type: NSString | APNs topic (bundle identifier). |
| `block`Type: PNPushNotificationsStateModificationCompletionBlock | `Remove notifications from channels` request completion block. |

### Sample code

#### Remove device from channel

```objectivec
[self.client removePushNotificationsFromChannels:@[@"wwdc",@"google.io"]
                                withDevicePushToken:self.devicePushToken
                                    andCompletion:^(PNAcknowledgmentStatus *status) {

    if (!status.isError) {

        // Handle successful push notification disabling on passed channels.
    }
    else {

        /**
            Handle modification error. Check 'category' property
            to find out possible reason because of which request did fail.
            Review 'errorData' property (which has PNErrorData data type) of status
            object to get additional information about issue.

            Request can be resent using: [status retry];
            */
    }
}];
```

### Response

Response objects which is returned by client when APNS Remove Device API is used:

```objectivec
@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end

@interface PNAcknowledgmentStatus : PNErrorStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end
```

### Other examples

#### Example for method no. 2

```objectivec
[self.client removePushNotificationsFromChannels:@[@"wwdc",@"google.io"]
                                withDevicePushToken:self.devicePushToken
                                        pushType:PNFCMPush
                                    andCompletion:^(PNAcknowledgmentStatus *status) {

    if (!status.isError) {
        // Push notification successfully disabled on passed channels.
    } else {
        /**
            * Handle modification error. Check 'category' property to find out possible issue because
            * of which request did fail.
            *
            * Request can be resent using: [status retry];
            */
    }
}];
```

#### Example for method no. 3

```objectivec
[self.client removePushNotificationsFromChannels:@[@"wwdc",@"google.io"]
                                withDevicePushToken:self.devicePushToken
                                        pushType:PNAPNS2Push
                                        environment:PNAPNSProduction
                                            topic:@"com.my-application.bundle"
                                    andCompletion:^(PNAcknowledgmentStatus *status) {

    if (!status.isError) {
        // Push notification successfully disabled on passed channels.
    } else {
        /**
            * Handle modification error. Check 'category' property to find out possible issue because
            * of which request did fail.
            *
            * Request can be resent using: [status retry];
            */
    }
}];
```

## Remove device from channel (builder pattern)

:::note Requires Mobile Push Notifications add-on
This method requires that the Mobile Push Notifications add-on is enabled for your key in the [Admin Portal](https://admin.pubnub.com/). Read the [support page](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-) on enabling add-on features on your keys.
:::

Disable mobile push notifications on provided set of channels.

### Method(s)

To run `Removing Device From Channel`, you can use the following method(s) in the Cocoa SDK.

#### APNS2 token

```objectivec
push()
    .disable()
    .token(id)
    .pushType(PNPushType)
    .channels(NSArray<NSString *> *)
    .environment(PNAPNSEnvironment)
    .topic(NSString *)
    .performWithCompletion(nullable PNPushNotificationsStateModificationCompletionBlock);
```

| Parameter | Description |
| --- | --- |
| `channels` *Type: NSArray`<NSString *>` * | List of channel names for which mobile push notifications should be disabled. |
| `token` *Type: id | Device token / identifier that you must set to `NSData`. |
| `pushType` *Type: PNPushType | One of: `PNFCMPush`. |
| `environment`Type: PNAPNSEnvironment | APNs environment. |
| `topic`Type: NSString | APNs topic (bundle identifier). |
| `block`Type: PNPushNotificationsStateModificationCompletionBlock | `Remove notifications from channels` request completion block. |

:::note Optional arguments
This method uses the builder pattern, you can remove the arguments which are optional.
:::

#### FCM token

```objectivec
push()
    .disable()
    .fcmToken(NSString *)
    .channels(NSArray<NSString *> *)
    .performWithCompletion(nullable PNPushNotificationsStateModificationCompletionBlock);
```

| Parameter | Description |
| --- | --- |
| `channels` *Type: NSArray`<NSString *>` * | List of channel names for which mobile push notifications should be disabled. `If passed list is empty all notifications will be disabled`. |
| `fcmToken` *Type: NSString * | FCM-provided device push token which should be used to disable push `notifications` on specified set of `channels`. |
| `completion`Type: PNPushNotificationsStateAuditCompletionBlock | Push `notifications` removal from `channels` processing completion `block` which pass only one argument - request processing `status` to report about how data pushing was successful or not. |

:::note Optional arguments
This method uses the builder pattern, you can remove the arguments which are optional.
:::

### Sample code

#### APNS token

```objectivec
self.client.push().disable()
    .token(self.devicePushToken)
    .channels(@[@"wwdc",@"google.io"])
    .pushType(PNAPNS2Push)
    .environment(PNAPNSProduction)
    .topic(@"com.my-application.bundle")
    .performWithCompletion(^(PNAcknowledgmentStatus *status) {
        if (!status.isError) {
            // Push notification successfully disabled on passed channels.
        } else {
            /**
                * Handle modification error. Check 'category' property to find out possible issue because
                * of which request did fail.
                *
                * Request can be resent using: [status retry];
                */
        }
    });
```

#### FCM token

```objectivec
self.client.push().disable()
    .channels(@[@"channel1", @"channel2"])
    .fcmToken(self.pushToken)
    .performWithCompletion(^(PNAcknowledgmentStatus *status) {
        if (!status.isError) {
            // Handle successful push notification enabling on passed channels.
        } else {
            /**
            Handle modification error. Check 'category' property
            to find out possible reason because of which request did fail.
            Review 'errorData' property (which has PNErrorData data type) of status
            object to get additional information about issue.

            Request can be resent using: [status retry];
            */
        }
    });
```

### Response

Response objects which is returned by client when APNS Remove Device API is used:

```objectivec
@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end

@interface PNAcknowledgmentStatus : PNErrorStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end
```

## Remove all mobile push notifications

:::note Requires Mobile Push Notifications add-on
This method requires that the Mobile Push Notifications add-on is enabled for your key in the [Admin Portal](https://admin.pubnub.com/). Read the [support page](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-) on enabling add-on features on your keys.
:::

Disable mobile push notifications from all channels registered with the specified pushToken.

### Method(s)

To run `Remove all mobile push notifications`, you can use the following method(s) in the Cocoa SDK:

```objectivec
- (void)removeAllPushNotificationsFromDeviceWithPushToken:(NSData *)pushToken
                                            andCompletion:(nullable PNPushNotificationsStateModificationCompletionBlock)block;
```

| Parameter | Description |
| --- | --- |
| `pushToken` *Type: NSData | Device push token which should be used to disable push `notifications` on specified set of `channels`. |
| `block`Type: PNPushNotificationsStateModificationCompletionBlock | Push `notifications` removal from device processing completion `block` which pass only one argument - request processing `status` to report about how data pushing was successful or not. |

```objectivec
- (void)removeAllPushNotificationsFromDeviceWithPushToken:(id)pushToken
                                                 pushType:(PNPushType)pushType
                                            andCompletion:(nullable PNPushNotificationsStateModificationCompletionBlock)block;
```

| Parameter | Description |
| --- | --- |
| `pushToken` *Type: id | Device token / identifier that you must set to `NSString`. |
| `pushType` *Type: PNPushType | One of: `PNFCMPush`. |
| `block`Type: PNPushNotificationsStateModificationCompletionBlock | `Remove all notifications` request completion block. |

```objectivec
- (void)removeAllPushNotificationsFromDeviceWithPushToken:(id)pushToken
                                                 pushType:(PNPushType)pushType
                                              environment:(PNAPNSEnvironment)environment
                                                    topic:(NSString *)topic
                                            andCompletion:(nullable PNPushNotificationsStateModificationCompletionBlock)block;
```

| Parameter | Description |
| --- | --- |
| `channels` *Type: NSArray`<NSString *>` * | List of channel names for which mobile push notifications should be disabled. |
| `pushToken` *Type: id | Device token / identifier that you must set to `NSData`. |
| `pushType` *Type: PNPushType | One of: `PNAPNS2Push`. |
| `environment` *Type: PNAPNSEnvironment | APNs environment. |
| `topic` *Type: NSString | APNs topic (bundle identifier). |
| `block`Type: PNPushNotificationsStateModificationCompletionBlock | `Remove all notifications` request completion block. |

### Sample code

#### Remove all mobile push notifications

```objectivec
[self.client removeAllPushNotificationsFromDeviceWithPushToken:self.devicePushToken
                                                 andCompletion:^(PNAcknowledgmentStatus *status) {

    if (!status.isError) {

        /**
         Handle successful push notification disabling for all channels associated with
         specified device push token.
         */
    }
    else {

        /**
         Handle modification error. Check 'category' property
         to find out possible reason because of which request did fail.
         Review 'errorData' property (which has PNErrorData data type) of status
         object to get additional information about issue.

         Request can be resent using: [status retry];
         */
    }
}];
```

### Response

Response objects which is returned by client when APNS Remove All Devices API is used:

```objectivec
@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end

@interface PNAcknowledgmentStatus : PNErrorStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end
```

### Other examples

1. Example For Method no. 2 1[self.client removeAllPushNotificationsFromDeviceWithPushToken:self.devicePushToken2 pushType:PNFCMPush3 andCompletion:^(PNAcknowledgmentStatus *status) {4 5 if (!status.isError) {6 /**7 * Push notification successfully disabled for all channels associated with specified8 * device push token.9 */10 } else {11 /**12 * Handle modification error. Check 'category' property to find out possible issue because13 * of which request did fail.14 *15 * Request can be resent using: [status retry];16 */17 }18}];
2. Example For Method no. 3 1[self.client removeAllPushNotificationsFromDeviceWithPushToken:self.devicePushToken2 pushType:PNAPNS2Push3 environment:PNAPNSProduction4 topic:@"com.my-application.bundle"5 andCompletion:^(PNAcknowledgmentStatus *status) {6 7 if (!status.isError) {8 /**9 * Push notification successfully disabled for all channels associated with specified10 * device push token.11 */12 } else {13 /**14 * Handle modification error. Check 'category' property to find out possible issue because15 * of which request did fail.16 *17 * Request can be resent using: [status retry];18 */19 }20}];

## Remove all mobile push notifications (builder pattern)

:::note Requires Mobile Push Notifications add-on
This method requires that the Mobile Push Notifications add-on is enabled for your key in the [Admin Portal](https://admin.pubnub.com/). Read the [support page](https://support.pubnub.com/hc/en-us/articles/360051974791-How-do-I-enable-add-on-features-for-my-keys-) on enabling add-on features on your keys.
:::

### Method(s)

```objectivec
push()
    .disableAll()
    .token(id)
    .pushType(PNPushType)
    .environment(PNAPNSEnvironment)
    .topic(NSString *)
    .performWithCompletion(nullable PNPushNotificationsStateModificationCompletionBlock);
```

| Parameter | Description |
| --- | --- |
| `token` *Type: id | Device token / identifier which depending from passed `pushType` should be `NSData` (for `PNAPNS2Push`) or `NSString` for other. |
| `pushType` *Type: PNPushType | One of: `PNAPNS2Push`, `PNFCMPush`. |
| `environment`Type: PNAPNSEnvironment | APNs environment. |
| `topic`Type: NSString | APNs topic (bundle identifier). |
| `block`Type: PNPushNotificationsStateModificationCompletionBlock | `Remove all notifications` request completion block. |

:::note Optional arguments
This method uses the builder pattern, you can remove the arguments which are optional.
:::

### Sample code

#### Remove all mobile push notifications, using builder pattern

```objectivec
self.client.push().disableAll()
    .token(self.devicePushToken)
    .pushType(PNAPNS2Push)
    .environment(PNAPNSProduction)
    .topic(@"com.my-application.bundle")
    .performWithCompletion(^(PNAcknowledgmentStatus *status) {
        if (!status.isError) {
            /**
             * Push notification successfully disabled for all channels associated with specified
             * device push token.
             */
        } else {
            /**
             * Handle modification error. Check 'category' property to find out possible issue because
             * of which request did fail.
             *
             * Request can be resent using: [status retry];
             */
        }
    });
```

### Response

Response object returned by the client when `APNS Remove All Devices` API is used:

```objectivec
@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end

@interface PNAcknowledgmentStatus : PNErrorStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end
```

## Terms in this document

* **Channel** - A pathway for sending and receiving messages between devices, created automatically when you first use it, that can handle any number of users and messages for different communication needs, like 1-1 text chats, group conversations, and other data streaming.
* **PubNub** - PubNub is a real-time messaging platform that provides APIs and SDKs for building scalable applications. It handles the complex infrastructure of real-time communication, including: Message delivery and persistence, Presence detection, Access control, Push notifications, File sharing, Serverless processing with Functions and Events & Actions, Analytics and monitoring with BizOps Workspace, AI-powered insights with Illuminate.
