CocoaCocoaiOSObjective-CCocoa Mobile Push API Reference for Realtime Apps

Go to Storage & Playback


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 Objective-C 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.
[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 PNAcknowledgmentStatus : PNErrorStatus

@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 Objective-C 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.
 [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 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

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

@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 Objective-C SDK
  1. ParameterTypeRequiredDescription
    channels
    NSArray
    Yes
    List of channel names for which push notifications should be disabled. If passed list is empty all notifications will be disabled.
    pushToken
    NSData
    Yes
    Device push token which should be used to disable push notifications on specified set of channels.
    block
    PNPushNotificationsStateModificationCompletionBlock
    No
    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.
[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 PNAcknowledgmentStatus : PNErrorStatus

@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 Objective-C SDK
  1. ParameterTypeRequiredDescription
    pushToken
    NSData
    Yes
    Device push token which should be used to disable push notifications on specified set of channels.
    block
    PNPushNotificationsStateModificationCompletionBlock
    No
    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.
[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 PNAcknowledgmentStatus : PNErrorStatus

@end

Go to MISCELLANEOUS