SBBNotificationManager Class Reference

Inherits from SBBBridgeAPIManager : NSObject
Conforms to SBBComponent
SBBNotificationManagerProtocol
Declared in SBBNotificationManager.h
SBBNotificationManager.m

Overview

This class handles communication with the Bridge Notifications API.

– registerWithDeviceToken:completion:

Register the push notifications deviceId (provided by iOS when registering for push notifications) with Bridge.

- (NSURLSessionTask *)registerWithDeviceToken:(NSData *)deviceToken completion:(SBBNotificationManagerCompletionBlock)completion

Parameters

deviceToken

The device token passed in to the app delegate upon registering with iOS for push notifications via the AppDelegate’s application:didRegisterForRemoteNotificationsWithDeviceToken: method (or application(_:didRegisterForRemoteNotificationsWithDeviceToken:) in Swift).

completion

An SBBNotificationManagerCompletionBlock to be called upon completion.

Return Value

An NSURLSessionTask object so you can cancel or suspend/resume the request.

Discussion

You should call this method in the AppDelegate’s application:didRegisterForRemoteNotificationsWithDeviceToken: method (or application(_:didRegisterForRemoteNotificationsWithDeviceToken:) in Swift). If this account is not already registered with Bridge for push notifications, it will be registered. If it is, the registration will be updated in case the deviceToken has changed.

Declared In

SBBNotificationManager.h

– unregisterWithCompletion:

Unregister for push notifications from Bridge.

- (NSURLSessionTask *)unregisterWithCompletion:(SBBNotificationManagerCompletionBlock)completion

Parameters

completion

An SBBNotificationManagerCompletionBlock to be called upon completion.

Return Value

An NSURLSessionTask object so you can cancel or suspend/resume the request.

Discussion

You should call this method if the participant changes their notification permission settings to not allow push notifications.

Declared In

SBBNotificationManager.h

– getSubscriptionStatuses:

Get current notification topic subscription statuses from Bridge.

- (NSURLSessionTask *)getSubscriptionStatuses:(SBBNotificationManagerSubscriptionStatusCompletionBlock)completion

Parameters

completion

An SBBNotificationManagerSubscriptionStatusCompletionBlock to be called upon completion.

Return Value

An NSURLSessionTask object so you can cancel or suspend/resume the request.

Declared In

SBBNotificationManager.h

– subscribeToTopicGuids:completion:

Update notification topic subscriptions to Bridge.

- (NSURLSessionTask *)subscribeToTopicGuids:(NSArray<NSString*> *)topicGuids completion:(SBBNotificationManagerSubscriptionStatusCompletionBlock)completion

Parameters

topicGuids

An array of topicGuid strings to which the account should be subscribed. Any topics whose guids are not in this array will be unsubscribed. Passing in an empty NSArray will unsubscribe the participant from all topics.

completion

An SBBNotificationManagerSubscriptionStatusCompletionBlock to be called upon completion.

Return Value

An NSURLSessionTask object so you can cancel or suspend/resume the request.

Discussion

If the app is not currently registered for push notifications with Bridge, this will return nil and will call the completion handler with error code SBBErrorCodeNotRegisteredForPushNotifications.

Declared In

SBBNotificationManager.h