Objective-CCocoaCocoaiOSCocoa Mobile Push API Reference for Realtime Apps

PubNub's Mobile Push Gateway feature enables developers to bridge native PubNub publishing with 3rd-party push notification services including Google Android GCM (Google Cloud Messaging)/FCM (Firebase Cloud Messaging), Apple iOS APNS (Apple Push Notification Service), and Microsoft Windows Phone MPNS (Microsoft Push Notification Service).

By using the Mobile Push Gateway, developers can eliminate the need for developing, configuring, and maintaining additional server-side components for 3rd-party push notification providers.

Learn more about our Mobile Push Gateway here.


Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Enable push notifications on provided set of channels.
To run Adding Device to Channel you can use the following method(s) in the Cocoa SDK
  1. ParameterTypeRequiredDescription
    channelsNSArrayYesList of channel names for which push notifications should be enabled.
    pushTokenNSDataYesDevice push token which should be used to enabled push notifications on specified set of channels.
    blockPNPushNotificationsStateModificationCompletionBlockNoPush 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.
  2. ParameterTypeRequiredDescription
    channelsNSArray<NSString *> *YesList of channel names for which push notifications should be enabled.
    pushTokenidYesDevice token / identifier which depending from passed pushType should be NSData (for PNAPNS2Push and PNAPNSPush) or NSString for other.
    pushTypePNPushTypeYesOne of PNPushType fields which specify service to manage notifications for device specified with pushToken.
    blockPNPushNotificationsStateModificationCompletionBlockNoAdd notifications for channels request completion block.
  3. ParameterTypeRequiredDescription
    channelsNSArray<NSString *>YesList of channel names for which push notifications should be enabled.
    pushTokenidYesDevice token / identifier which depending from passed pushType should be NSData (for PNAPNS2Push and PNAPNSPush) or NSString for other.
    pushTypePNPushTypeYesOne of PNPushType fields which specify service to manage notifications for device specified with pushToken.
    environmentPNAPNSEnvironmentYesOne of PNAPNSEnvironment fields which specify environment within which device should manage list of channels with enabled notifications (works only if pushType set to PNAPNS2Push).
    topicNSStringYesNotifications topic name (usually it is application's bundle identifier).
    blockPNPushNotificationsStateModificationCompletionBlockNoAdd notifications for channels request completion block.
[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 objects which is returned by client when APNS Add Device API is used:

@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
  1. Example For Method no. 2
    [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];
             */
        }
    }];
  2. Example For Method no. 3
    [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];
             */
        }
    }];
Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Enable push notifications on provided set of channels.
To run Adding Device to Channel you can use the following method(s) in the Cocoa SDK

  1. ParameterTypeRequiredDescription
    channelsNSArray<NSString *>YesList of channel names for which push notifications should be enabled.
    tokenidYesDevice token / identifier which depending from passed pushType should be NSData (for PNAPNS2Push and PNAPNSPush) or NSString for other.
    pushTypePNPushTypeYesOne of PNPushType fields which specify service to manage notifications for device specified with pushToken.
    environmentPNAPNSEnvironmentNoOne of PNAPNSEnvironment fields which specify environment within which device should manage list of channels with enabled notifications (works only if pushType set to PNAPNS2Push).
    topicNSStringNoNotifications topic name (usually it is application's bundle identifier).
    blockPNPushNotificationsStateModificationCompletionBlockNoAdd notifications for channels request completion block.
     

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

  1. ParameterTypeRequiredDescription
    channelsNSArray<NSString *> *YesList of channel names for which push notifications should be enabled.
    fcmTokenNSString *YesFCM-provided device push token which should be used to enabled push notifications on specified set of channels.
    completionPNPushNotificationsStateModificationCompletionBlockNoPush 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.
     

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


self.client.push().enable()
    .token(self.devicePushToken)
    .channels(@[@"wwdc",@"google.io"])
    .pushType(PNAPNSPush)
    .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];
             */
        }
    });
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];
             */
        }
    });
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 objects which is returned by client when APNS Add Device API is used:

@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

Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Request for all channels on which push notification has been enabled using specified pushToken.
To run Listing Channels For Device you can use the following method(s) in the Cocoa SDK
  1. ParameterTypeRequiredDescription
    pushTokenNSDataYesDevice push token against which search on PubNub service should be performed.
    blockPNPushNotificationsStateAuditCompletionBlockYesPush 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.
  2. ParameterTypeRequiredDescription
    pushTokenidYesDevice token / identifier which depending from passed pushType should be NSData (for PNAPNS2Push and PNAPNSPush) or NSString for other.
    pushTypePNPushTypeYesOne of PNPushType fields which specify service to manage notifications for device specified with pushToken.
    blockPNPushNotificationsStateAuditCompletionBlockYesAudit notifications enabled channels request completion block.
  3. ParameterTypeRequiredDescription
    pushTokenidYesDevice token / identifier which depending from passed pushType should be NSData (for PNAPNS2Push and PNAPNSPush) or NSString for other.
    pushTypePNPushTypeYesOne of PNPushType fields which specify service to manage notifications for device specified with pushToken.
    environmentPNAPNSEnvironmentYesOne of PNAPNSEnvironment fields which specify environment within which device should manage list of channels with enabled notifications (works only if pushType set to PNAPNS2Push).
    topicNSStringYesNotifications topic name (usually it is application's bundle identifier).
    blockPNPushNotificationsStateAuditCompletionBlockYesAudit notifications enabled channels request completion block.
 [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 objects which is returned by clientAPNS List Devices API is used:
@interface PNAPNSEnabledChannelsData : PNServiceData

// Channels with active 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 resonse which is used in case of APNS List Devices API call failure:

@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
  1. Example For Method no. 2
    [self.client pushNotificationEnabledChannelsForDeviceWithPushToken:self.devicePushToken
                             pushType:PNAPNSPush
                        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];
             */
        }
    }];
  2. Example For Method no. 3
    [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];
             */
        }
    }];
Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Request for all channels on which push notification has been enabled using specified pushToken.
To run Listing Channels For Device you can use the following method(s) in the Cocoa SDK

  1. ParameterTypeRequiredDescription
    tokenidYesDevice token / identifier which depending from passed pushType should be NSData (for PNAPNS2Push and PNAPNSPush) or NSString for other.
    pushTypePNPushTypeYesOne of PNPushType fields which specify service to manage notifications for device specified with pushToken.
    environmentPNAPNSEnvironmentNoOne of PNAPNSEnvironment fields which specify environment within which device should manage list of channels with enabled notifications (works only if pushType set to PNAPNS2Push).
    topicNSStringNoNotifications topic name (usually it is application's bundle identifier).
    blockPNPushNotificationsStateAuditCompletionBlockYesAudit notifications enabled channels request completion block.
     

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

  1. ParameterTypeRequiredDescription
    fcmTokenNSString *YesFCM-provided device push token against which search on PubNub service should be performed.
    completionPNPushNotificationsStateAuditCompletionBlockYesPush 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.
     

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


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];
             */
        }
    });
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 objects which is returned by client when APNS List Devices API is used:

@interface PNAPNSEnabledChannelsData : PNServiceData

// Channels with active 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 resonse which is used in case of APNS List Devices API call failure:

@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

Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Disable push notifications on provided set of channels.
To run Removing Device From Channel you can use the following method(s) in the Cocoa SDK
  1. ParameterTypeRequiredDescription
    channelsNSArrayYesList of channel names for which push notifications should be disabled. If passed list is empty all notifications will be disabled.
    pushTokenNSDataYesDevice push token which should be used to disable push notifications on specified set of channels.
    blockPNPushNotificationsStateModificationCompletionBlockNoPush 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.
  2. ParameterTypeRequiredDescription
    channelsNSArray<NSString *> *YesList of channel names for which push notifications should be disabled.
    pushTokenidYesDevice token / identifier which depending from passed pushType should be NSData (for PNAPNS2Push and PNAPNSPush) or NSString for other.
    pushTypePNPushTypeYesOne of PNPushType fields which specify service to manage notifications for device specified with pushToken.
    blockPNPushNotificationsStateModificationCompletionBlockNoRemove notifications from channels request completion block.
  3. ParameterTypeRequiredDescription
    channelsNSArray<NSString *> *YesList of channel names for which push notifications should be disabled.
    pushTokenidYesDevice token / identifier which depending from passed pushType should be NSData (for PNAPNS2Push and PNAPNSPush) or NSString for other.
    pushTypePNPushTypeYesOne of PNPushType fields which specify service to manage notifications for device specified with pushToken.
    environmentPNAPNSEnvironmentYesOne of PNAPNSEnvironment fields which specify environment within which device should manage list of channels with enabled notifications (works only if pushType set to PNAPNS2Push).
    topicNSStringYesNotifications topic name (usually it is application's bundle identifier).
    blockPNPushNotificationsStateModificationCompletionBlockNoRemove notifications from channels request completion block.
[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 objects which is returned by client when APNS Remove Device API is used:
@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
  1. Example For Method no. 2
    [self.client removePushNotificationsFromChannels:@[@"wwdc",@"google.io"]
                                 withDevicePushToken:self.devicePushToken
                                            pushType:PNAPNSPush
                                       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];
             */
        }
    }];
  2. Example For Method no. 3
    [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];
             */
        }
    }];
Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Disable push notifications on provided set of channels.
To run Removing Device From Channel you can use the following method(s) in the Cocoa SDK

  1. ParameterTypeRequiredDescription
    channelsNSArray<NSString *> *YesList of channel names for which push notifications should be disabled.
    tokenidYesDevice token / identifier which depending from passed pushType should be NSData (for PNAPNS2Push and PNAPNSPush) or NSString for other.
    pushTypePNPushTypeYesOne of PNPushType fields which specify service to manage notifications for device specified with pushToken.
    environmentPNAPNSEnvironmentNoOne of PNAPNSEnvironment fields which specify environment within which device should manage list of channels with enabled notifications (works only if pushType set to PNAPNS2Push).
    topicNSStringNoNotifications topic name (usually it is application's bundle identifier).
    blockPNPushNotificationsStateModificationCompletionBlockNoRemove notifications from channels request completion block.
     

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

  1. ParameterTypeRequiredDescription
    channelsNSArray<NSString *> *YesList of channel names for which push notifications should be disabled. If passed list is empty all notifications will be disabled.
    fcmTokenNSString *YesFCM-provided device push token which should be used to disable push notifications on specified set of channels.
    completionPNPushNotificationsStateAuditCompletionBlockNoPush 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.
     

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


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];
             */
        }
    });
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 objects which is returned by client when APNS Remove Device API is used:
@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

Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
Disable push notifications from all channels which is registered with specified pushToken.
To run Remove all push notifications you can use the following method(s) in the Cocoa SDK
  1. ParameterTypeRequiredDescription
    pushTokenNSDataYesDevice push token which should be used to disable push notifications on specified set of channels.
    blockPNPushNotificationsStateModificationCompletionBlockNoPush 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.
  2. ParameterTypeRequiredDescription
    pushTokenidYesDevice token / identifier which depending from passed pushType should be NSData (for PNAPNS2Push and PNAPNSPush) or NSString for other.
    pushTypePNPushTypeYesOne of PNPushType fields which specify service to manage notifications for device specified with pushToken.
    blockPNPushNotificationsStateModificationCompletionBlockNoRemove all notifications request completion block.
  3. ParameterTypeRequiredDescription
    channelsNSArray<NSString *> *YesList of channel names for which push notifications should be disabled.
    pushTokenidYesDevice token / identifier which depending from passed pushType should be NSData (for PNAPNS2Push and PNAPNSPush) or NSString for other.
    pushTypePNPushTypeYesOne of PNPushType fields which specify service to manage notifications for device specified with pushToken.
    environmentPNAPNSEnvironmentYesOne of PNAPNSEnvironment fields which specify environment within which device should manage list of channels with enabled notifications (works only if pushType set to PNAPNS2Push).
    topicNSStringYesNotifications topic name (usually it is application's bundle identifier).
    blockPNPushNotificationsStateModificationCompletionBlockNoRemove all notifications request completion block.
[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 objects which is returned by client when APNS Remove All Devices API is used:
@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
  1. Example For Method no. 2
    [self.client removeAllPushNotificationsFromDeviceWithPushToken:self.devicePushToken
                                                          pushType:PNAPNSPush
                                                     andCompletion:^(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];
             */
        }
    }];
  2. Example For Method no. 3
    [self.client removeAllPushNotificationsFromDeviceWithPushToken:self.devicePushToken
                                                          pushType:PNAPNS2Push
                                                       environment:PNAPNSProduction
                                                             topic:@"com.my-application.bundle"
                                                     andCompletion:^(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];
             */
        }
    }];

Requires Mobile Push Notifications add-on XRequires that the Mobile Push Notifications add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.
  1. ParameterTypeRequiredDescription
    tokenidYesDevice token / identifier which depending from passed pushType should be NSData (for PNAPNS2Push and PNAPNSPush) or NSString for other.
    pushTypePNPushTypeYesOne of PNPushType fields which specify service to manage notifications for device specified with pushToken.
    environmentPNAPNSEnvironmentNoOne of PNAPNSEnvironment fields which specify environment within which device should manage list of channels with enabled notifications (works only if pushType set to PNAPNS2Push).
    topicNSStringNoNotifications topic name (usually it is application's bundle identifier).
    blockPNPushNotificationsStateModificationCompletionBlockNoRemove all notifications request completion block.
 

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

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 objects which is returned by client when APNS Remove All Devices API is used:

@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