BMSPushClient
public class BMSPushClient : NSObject
A singleton that serves as an entry point to IBM Cloud client-Push service communication.
-
This singleton should be used for all
BMSPushClient
activity.Declaration
Swift
public static let sharedInstance: BMSPushClient
-
The required intializer for the
BMSPushClient
class.This method will intialize the BMSPushClient with clientSecret based registration.
Declaration
Swift
public func initializeWithAppGUID(appGUID: String, clientSecret: String)
Parameters
clientSecret
The clientSecret of the Push Service
appGUID
The pushAppGUID of the Push Service
-
The required intializer for the
BMSPushClient
class.This method will intialize the BMSPushClient with clientSecret based registration and take in notificationOptions.
Declaration
Swift
public func initializeWithAppGUID(appGUID: String, clientSecret: String, options: BMSPushClientOptions)
Parameters
clientSecret
The clientSecret of the Push Service
appGUID
The pushAppGUID of the Push Service
options
The push notification options
-
This Methode used to register the client device to the IBM Cloud Push service. This is the normal registration, without userId.
Call this methode after successfully registering for remote push notification in the Apple Push Notification Service .
Declaration
Swift
public func registerWithDeviceToken(deviceToken: Data, WithUserId: String?, completionHandler: @escaping (_ response: String?, _ statusCode: Int?, _ error: String) -> Void)
Parameters
deviceToken
This is the response we get from the push registartion in APNS.
WithUserId
This is the userId value.
completionHandler
The closure that will be called when this request finishes. The response will contain response (String), StatusCode (Int) and error (string).
-
This Methode used to register the client device to the IBM Cloud Push service. This is the normal registration, without userId.
Call this methode after successfully registering for remote push notification in the Apple Push Notification Service .
Declaration
Swift
public func registerWithDeviceToken(deviceToken: Data, completionHandler: @escaping (_ response: String?, _ statusCode: Int?, _ error: String) -> Void)
Parameters
deviceToken
This is the response we get from the push registartion in APNS.
completionHandler
The closure that will be called when this request finishes. The response will contain response (String), StatusCode (Int) and error (string).
-
This Method used to Retrieve all the available Tags in the IBM Cloud Push Service.
This methode will return the list of available Tags in an Array.
Declaration
Swift
public func retrieveAvailableTagsWithCompletionHandler(completionHandler: @escaping (_ response: NSMutableArray?, _ statusCode: Int?, _ error: String) -> Void)
Parameters
completionHandler
The closure that will be called when this request finishes. The response will contain response (NSMutableArray), StatusCode (Int) and error (string).
-
This Methode used to Subscribe to the Tags in the IBM Cloud Push srvice.
This methode will return the list of subscribed tags. If you pass the tags that are not present in the IBM Cloud App it will be classified under the TAGS NOT FOUND section in the response.
Declaration
Swift
public func subscribeToTags(tagsArray: NSArray, completionHandler: @escaping (_ response: NSMutableDictionary?, _ statusCode: Int?, _ error: String) -> Void)
Parameters
tagsArray
the array that contains name tags.
completionHandler
The closure that will be called when this request finishes. The response will contain response (NSMutableDictionary), StatusCode (Int) and error (string).
-
This Methode used to Retrieve the Subscribed Tags in the IBM Cloud Push srvice.
This methode will return the list of subscribed tags.
Declaration
Swift
public func retrieveSubscriptionsWithCompletionHandler(completionHandler: @escaping (_ response: NSMutableArray?, _ statusCode: Int?, _ error: String) -> Void)
Parameters
completionHandler
The closure that will be called when this request finishes. The response will contain response (NSMutableArray), StatusCode (Int) and error (string).
-
This Methode used to Unsubscribe from the Subscribed Tags in the IBM Cloud Push srvice.
This methode will return the details of Unsubscription status.
Declaration
Swift
public func unsubscribeFromTags(tagsArray: NSArray, completionHandler: @escaping (_ response: NSMutableDictionary?, _ statusCode: Int?, _ error: String) -> Void)
Parameters
tagsArray
The list of tags that need to be unsubscribed.
completionHandler
The closure that will be called when this request finishes. The response will contain response (NSMutableDictionary), StatusCode (Int) and error (string).
-
This Methode used to UnRegister the client App from the IBM Cloud Push srvice.
Declaration
Swift
public func unregisterDevice(completionHandler: @escaping (_ response: String?, _ statusCode: Int?, _ error: String) -> Void)
Parameters
completionHandler
The closure that will be called when this request finishes. The response will contain response (String), StatusCode (Int) and error (string).