SBDMain Class Reference

Inherits from NSObject
Declared in SBDMain.h

Overview

The SBDMain is the core class for SendBird. This class is singletone instance which is initialized by Application ID. This class provides the methods for overall. The methods include SBDChannelDelegate registration for receiving events are related to channels, SBDConnectionDelegate for managing the connection status, updating the current user’s information, registration for APNS push notification and blocking other users.

  logLevel

Shows the current log level.

@property (atomic) SBDLogLevel logLevel

Declared In

SBDMain.h

  connectionDelegatesDictionary

Manages registered SBDConnectionDelegate.

@property (nonatomic, strong, readonly, nullable) NSMapTable<NSString*id<SBDConnectionDelegate> > *connectionDelegatesDictionary

Declared In

SBDMain.h

  channelDelegatesDictionary

Manages registered SBDChannelDelegate.

@property (nonatomic, strong, readonly, nullable) NSMapTable<NSString*id<SBDChannelDelegate> > *channelDelegatesDictionary

Declared In

SBDMain.h

  userEventDelegatesDictionary

Manages registered SBDUserEventlDelegate.

@property (nonatomic, strong, readonly, nullable) NSMapTable<NSString*id<SBDUserEventDelegate> > *userEventDelegatesDictionary

Declared In

SBDMain.h

  backgroundSessionCompletionHandler

The completion handler of background session.

@property (nonatomic, strong, nullable) SBDBackgroundSessionBlock backgroundSessionCompletionHandler

Declared In

SBDMain.h

  backgroundTaskBlock

The list of tasks in background.

@property (strong, nonatomic, nonnull) NSMutableArray<SBDBackgroundSessionBlock> *backgroundTaskBlock

Declared In

SBDMain.h

  URLSessionDidFinishEventsForBackgroundURLSession

The number of URLSessionDidFinishEventsForBackgroundURLSession.

@property (atomic) int URLSessionDidFinishEventsForBackgroundURLSession

Declared In

SBDMain.h

+ getSDKVersion

Retrieves the SDK version.

+ (nonnull NSString *)getSDKVersion

Return Value

The SDK version.

Declared In

SBDMain.h

+ getLogLevel

Retrieves the log level.

+ (SBDLogLevel)getLogLevel

Return Value

Log level.

Declared In

SBDMain.h

+ getApplicationId

Gets the Application ID which was used for initialization.

+ (nullable NSString *)getApplicationId

Return Value

The Application ID.

Declared In

SBDMain.h

+ setLogLevel:

Sets the log level. The log level is defined by SBDLogLevel.

+ (void)setLogLevel:(SBDLogLevel)logLevel

Parameters

logLevel

Log level.

Declared In

SBDMain.h

+ getDebugMode

Gets the current debug mode.

+ (BOOL)getDebugMode

Return Value

If YES, this instance is debug mode.

Declared In

SBDMain.h

+ sharedInstance

Gets a singleton instance of SBDMain.

+ (nonnull SBDMain *)sharedInstance

Return Value

a singleton instance for SBDMain.

Declared In

SBDMain.h

+ isInitialized

Gets initializing state.

+ (BOOL)isInitialized

Return Value

If YES, SBDMain instance is initialized.

Declared In

SBDMain.h

+ initWithApplicationId:

Initializes SBDMain singleton instance with SendBird Application ID. The Application ID is on SendBird dashboard. This method has to be run first in order to user SendBird.

+ (BOOL)initWithApplicationId:(NSString *_Nonnull)applicationId

Parameters

applicationId

The Applicatin ID of SendBird. It can be founded on SendBird Dashboard.

Return Value

If YES, the applicationId is set.

Declared In

SBDMain.h

+ setSharedContainerIdentifier:

Initialize sharedContainerIdentifier of NSURLSessionConfiguration to use background session. Important! If you use App Extension and use upload file message in extension, you MUST set thie field.

+ (void)setSharedContainerIdentifier:(nonnull NSString *)identifier

Parameters

identifier

The identifier to set background session configuraion.

Declared In

SBDMain.h

+ connectWithUserId:completionHandler:

Performs a connection to SendBird with the user ID.

+ (void)connectWithUserId:(NSString *_Nonnull)userId completionHandler:(nullable void ( ^ ) ( SBDUser *_Nullable user , SBDError *_Nullable error ))completionHandler

Parameters

userId

The user ID.

completionHandler

The handler block to execute. user is the object to represent the current user.

Declared In

SBDMain.h

+ connectWithUserId:accessToken:completionHandler:

Performs a connection to SendBird with the user ID and the access token.

+ (void)connectWithUserId:(NSString *_Nonnull)userId accessToken:(NSString *_Nullable)accessToken completionHandler:(nullable void ( ^ ) ( SBDUser *_Nullable user , SBDError *_Nullable error ))completionHandler

Parameters

userId

The user ID.

accessToken

The access token. If the user doesn’t have access token, set nil.

completionHandler

The handler block to execute. user is the object to represent the current user.

Declared In

SBDMain.h

+ connectWithUserId:accessToken:apiHost:wsHost:completionHandler:

Performs a connection to SendBird with the user ID and the access token.

+ (void)connectWithUserId:(NSString *_Nonnull)userId accessToken:(NSString *_Nullable)accessToken apiHost:(NSString *_Nullable)apiHost wsHost:(NSString *_Nullable)wsHost completionHandler:(nullable void ( ^ ) ( SBDUser *_Nullable user , SBDError *_Nullable error ))completionHandler

Parameters

userId

userId

accessToken

accessToken

apiHost

apiHost

wsHost

wsHost

completionHandler

completionHandler

Discussion

Warning: Important: DON’T use this method. This method will be unavailable.

Declared In

SBDMain.h

+ getCurrentUser

Gets the current user object. The object is valid when the connection succeeded.

+ (nullable SBDUser *)getCurrentUser

Return Value

The current user object.

Declared In

SBDMain.h

+ getLastConnectedAt

Gets the current user’s latest connection millisecond time(UTC). If the connection state is not open, returns 0.

+ (long long)getLastConnectedAt

Return Value

latest connected millisecond time stamp.

Availability

3.0.117

Declared In

SBDMain.h

+ disconnectWithCompletionHandler:

Disconnects from SendBird. If this method is invoked, the current user will be invalidated.

+ (void)disconnectWithCompletionHandler:(nullable void ( ^ ) ( void ))completionHandler

Parameters

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ addConnectionDelegate:identifier:

+ (void)addConnectionDelegate:(id<SBDConnectionDelegate> _Nonnull)delegate identifier:(NSString *_Nonnull)identifier

Parameters

delegate

SBDConnectionDelegate delegate.

identifier

The identifier for the delegate.

Declared In

SBDMain.h

+ removeConnectionDelegateForIdentifier:

Removes the SBDConnectionDelegate by identifier.

+ (void)removeConnectionDelegateForIdentifier:(NSString *_Nonnull)identifier

Parameters

identifier

The identifier for the delegate to be removed.

Declared In

SBDMain.h

+ connectionDelegateForIdentifier:

Gets the delegate for connection by indentifer.

+ (nullable id<SBDConnectionDelegate>)connectionDelegateForIdentifier:(NSString *_Nonnull)identifier

Parameters

identifier

The identifier for delegate.

Return Value

SBDConnectionDelegate delegate.

Declared In

SBDMain.h

+ removeAllConnectionDelegates

Removes all connection delegates;

+ (void)removeAllConnectionDelegates

Declared In

SBDMain.h

+ addChannelDelegate:identifier:

Adds the SBDChannelDelegate.

+ (void)addChannelDelegate:(id<SBDChannelDelegate> _Nonnull)delegate identifier:(NSString *_Nonnull)identifier

Parameters

delegate

SBDChannelDelegate delegate.

identifier

The identifier for delegate.

Declared In

SBDMain.h

+ removeChannelDelegateForIdentifier:

Removes the SBDChannelDelegate by identifier.

+ (void)removeChannelDelegateForIdentifier:(NSString *_Nonnull)identifier

Parameters

identifier

The identifier for the delegate to be removed.

Declared In

SBDMain.h

+ channelDelegateForIdentifier:

Gets the delegate for channel by indentifer.

+ (nullable id<SBDChannelDelegate>)channelDelegateForIdentifier:(NSString *_Nonnull)identifier

Parameters

identifier

The identifier for delegate.

Return Value

SBDChannelDelegate delegate.

Declared In

SBDMain.h

+ removeAllChannelDelegates

Removes all channel delegates;

+ (void)removeAllChannelDelegates

Declared In

SBDMain.h

+ getConnectState

Gets the WebSocket server connection state.

+ (SBDWebSocketConnectionState)getConnectState

Return Value

SBDWebSocketConnectionState

  • SBDWebSocketConnecting - Connecting to the chat server
  • SBDWebSocketOpen - Connected to the chat server
  • SBSWebSocketClosed - Disconnected from the chat server

Declared In

SBDMain.h

+ setCompletionHandlerDelegateQueue:

Sets dispatch queue for every completion handler and delegate. Default queue is the main queue.

+ (void)setCompletionHandlerDelegateQueue:(dispatch_queue_t _Nullable)queue

Parameters

queue

Dispatch queue for every completion handler and delegate.

Declared In

SBDMain.h

+ performCompletionHandlerDelegateQueueBlock:

Runs block in the dispatch queue that was set by setCompletionHandlerDelegateQueue:.

+ (void)performCompletionHandlerDelegateQueueBlock:(dispatch_block_t _Nullable)block

Parameters

block

Block to run.

Declared In

SBDMain.h

+ createAllUserListQuery

Creates SBDUserListQuery instance for getting a list of all users of this application. (Deprecated: in 3.0.120. Use createApplicationUserListQuery.)

+ (nullable SBDUserListQuery *)createAllUserListQuery

Return Value

SBDUserListQuery instance.

Declared In

SBDMain.h

+ createUserListQueryWithUserIds:

Creates SBDUserListQuery instance for gettting a list of users of this application with user IDs. (Deprecated: in 3.0.120. Use createApplicationUserListQuery and userIdsFilter of SBDApplicationUserListQuery.)

+ (nullable SBDUserListQuery *)createUserListQueryWithUserIds:(NSArray<NSString*> *_Nonnull)userIds

Parameters

userIds

The user IDs to get user objects.

Return Value

SBDUserListQuery instance.

Declared In

SBDMain.h

+ createApplicationUserListQuery

Creates SBDApplicationUserListQuery instance for getting a list of all users of this application.

+ (nullable SBDApplicationUserListQuery *)createApplicationUserListQuery

Return Value

SBDApplicationUserListQuery instance

Availability

3.0.120

Declared In

SBDMain.h

+ createBlockedUserListQuery

Creates SBDBlockedUserListQuery instance for getting a list of blocked users by the current user.

+ (nullable SBDBlockedUserListQuery *)createBlockedUserListQuery

Return Value

SBDBlockedUserListQuery instance.

Declared In

SBDMain.h

+ updateCurrentUserInfoWithNickname:profileUrl:completionHandler:

Updates the current user’s information.

+ (void)updateCurrentUserInfoWithNickname:(NSString *_Nullable)nickname profileUrl:(NSString *_Nullable)profileUrl completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

Parameters

nickname

New nickname.

profileUrl

New profile image url.

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ updateCurrentUserInfoWithNickname:profileImage:completionHandler:

Updates the current user’s information.

+ (void)updateCurrentUserInfoWithNickname:(NSString *_Nullable)nickname profileImage:(NSData *_Nullable)profileImage completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

Parameters

nickname

New nickname.

profileImage

New profile image data.

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ updateCurrentUserInfoWithNickname:profileImage:progressHandler:completionHandler:

Updates the current user’s information.

+ (void)updateCurrentUserInfoWithNickname:(NSString *_Nullable)nickname profileImage:(NSData *_Nullable)profileImage progressHandler:(nullable void ( ^ ) ( int64_t bytesSent , int64_t totalBytesSent , int64_t totalBytesExpectedToSend ))progressHandler completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

Parameters

nickname

New nickname.

profileImage

New profile image data.

progressHandler

The handler block to monitor progression. bytesSent is the number of bytes sent since the last time this method was called. totalBytesSent is the total number of bytes sent so far. totalBytesExpectedToSend is the expected length of the body data. These parameters are the same to the declaration of URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:.

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ updateCurrentUserInfoWithNickname:profileImageFilePath:progressHandler:completionHandler:

Updates the current user’s information.

+ (void)updateCurrentUserInfoWithNickname:(NSString *_Nullable)nickname profileImageFilePath:(NSString *_Nullable)profileImageFilePath progressHandler:(nullable void ( ^ ) ( int64_t bytesSent , int64_t totalBytesSent , int64_t totalBytesExpectedToSend ))progressHandler completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

Parameters

nickname

New nickname.

profileImageFilePath

New profile image file path.

progressHandler

The handler block to monitor progression. bytesSent is the number of bytes sent since the last time this method was called. totalBytesSent is the total number of bytes sent so far. totalBytesExpectedToSend is the expected length of the body data. These parameters are the same to the declaration of URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:.

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ getPendingPushToken

Gets the pending push token.

+ (nullable NSData *)getPendingPushToken

Return Value

Returns the pending push token.

Declared In

SBDMain.h

+ registerDevicePushToken:unique:completionHandler:

Registers the current device token to SendBird.

+ (void)registerDevicePushToken:(NSData *_Nonnull)devToken unique:(BOOL)unique completionHandler:(nullable void ( ^ ) ( SBDPushTokenRegistrationStatus status , SBDError *_Nullable error ))completionHandler

Parameters

devToken

Device token for APNS.

unique

If YES, register device token after removing exsiting all device tokens of the current user. If NO, just add the device token.

completionHandler

The handler block to execute. status is the status for push token registration. It is defined in SBDPushTokenRegistrationStatus. SBDPushTokenRegistrationStatusSuccess represents the devToken is registered. SBDPushTokenRegistrationStatusPending represents the devToken is not registered because the connection is not established, so this method has to be invoked with getPendingPushToken method after the connection. The devToken is retrived by getPendingPushToken. SBDPushTokenRegistrationStatusError represents the push token registration is failed.

Declared In

SBDMain.h

+ registerDevicePushToken:completionHandler:

Registers the current device token to SendBird. (Deprecated: in 3.0.22)

+ (void)registerDevicePushToken:(NSData *_Nonnull)devToken completionHandler:(nullable void ( ^ ) ( SBDPushTokenRegistrationStatus status , SBDError *_Nullable error ))completionHandler

Parameters

devToken

Device token for APNS.

completionHandler

The handler block to execute. status is the status for push token registration. It is defined in SBDPushTokenRegistrationStatus. SBDPushTokenRegistrationStatusSuccess represents the devToken is registered. SBDPushTokenRegistrationStatusPending represents the devToken is not registered because the connection is not established, so this method has to be invoked with getPendingPushToken method after the connection. The devToken is retrived by getPendingPushToken. SBDPushTokenRegistrationStatusError represents the push token registration is failed.

Declared In

SBDMain.h

+ registerPushToken:completionHandler:

Registers the current device token to SendBird. (Deprecated: in 3.0.9)

+ (void)registerPushToken:(NSData *_Nonnull)devToken completionHandler:(nullable void ( ^ ) ( NSDictionary *_Nullable response , SBDError *_Nullable error ))completionHandler

Parameters

devToken

Device token for APNS.

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ unregisterPushToken:completionHandler:

Unregisters the current device token from SendBird.

+ (void)unregisterPushToken:(NSData *_Nonnull)devToken completionHandler:(nullable void ( ^ ) ( NSDictionary *_Nullable response , SBDError *_Nullable error ))completionHandler

Parameters

devToken

Device token for APNS.

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ unregisterAllPushTokenWithCompletionHandler:

Unregisters all device tokens for the current user from SendBird.

+ (void)unregisterAllPushTokenWithCompletionHandler:(nullable void ( ^ ) ( NSDictionary *_Nullable response , SBDError *_Nullable error ))completionHandler

Parameters

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ getPendingPushKitToken

Gets the pending push token for PushKit.

+ (nullable NSData *)getPendingPushKitToken

Return Value

Returns the pending push token for PushKit.

Availability

3.0.132

Declared In

SBDMain.h

+ registerDevicePushKitToken:unique:completionHandler:

Registers the current device token for PushKit to SendBird.

+ (void)registerDevicePushKitToken:(NSData *_Nonnull)devToken unique:(BOOL)unique completionHandler:(nullable void ( ^ ) ( SBDPushTokenRegistrationStatus status , SBDError *_Nullable error ))completionHandler

Parameters

devToken

Device token for PushKit.

unique

If YES, register device token after removing exsiting all device tokens of the current user. If NO, just add the device token.

completionHandler

The handler block to execute. status is the status for push token registration. It is defined in SBDPushTokenRegistrationStatus. SBDPushTokenRegistrationStatusSuccess represents the devToken is registered. SBDPushTokenRegistrationStatusPending represents the devToken is not registered because the connection is not established, so this method has to be invoked with getPendingPushToken method after the connection. The devToken is retrived by getPendingPushToken. SBDPushTokenRegistrationStatusError represents the push token registration is failed.

Availability

3.0.132

Declared In

SBDMain.h

+ unregisterPushKitToken:completionHandler:

Unregisters the current device token for PushKit from SendBird.

+ (void)unregisterPushKitToken:(NSData *_Nonnull)devToken completionHandler:(nullable void ( ^ ) ( NSDictionary *_Nullable response , SBDError *_Nullable error ))completionHandler

Parameters

devToken

Device token for PushKit.

completionHandler

The handler block to execute.

Availability

3.0.132

Declared In

SBDMain.h

+ unregisterAllPushKitTokenWithCompletionHandler:

Unregisters all device tokens for PushKit for the current user from SendBird.

+ (void)unregisterAllPushKitTokenWithCompletionHandler:(nullable void ( ^ ) ( NSDictionary *_Nullable response , SBDError *_Nullable error ))completionHandler

Parameters

completionHandler

The handler block to execute.

Availability

3.0.132

Declared In

SBDMain.h

+ getMyPushTokensByToken:pushTokenType:completionHandler:

Requests device push tokens list of current user after the token.

+ (void)getMyPushTokensByToken:(nullable NSString *)token pushTokenType:(SBDPushTokenType)pushTokenType completionHandler:(nonnull SBDGetPushTokensHandler)completionHandler

Parameters

token

The token used to get next pagination of deive push tokens.

pushTokenType

The enum type to represent the type of push token.

completionHandler

The handler block to be executed after requests. This block has no return value and takes 5 arguments that are device push token list, push token type you are requesting, boolean that indicates having next pagination, token to be used next pagination and error.

Availability

3.0.134

Declared In

SBDMain.h

+ blockUserId:completionHandler:

Blocks the specified user.

+ (void)blockUserId:(NSString *_Nonnull)userId completionHandler:(nullable void ( ^ ) ( SBDUser *_Nullable blockedUser , SBDError *_Nullable error ))completionHandler

Parameters

userId

The user ID to be blocked.

completionHandler

The handler block to execute. blockedUser is the blocked user by the current user.

Declared In

SBDMain.h

+ blockUser:completionHandler:

Blocks the specified user.

+ (void)blockUser:(SBDUser *_Nonnull)user completionHandler:(nullable void ( ^ ) ( SBDUser *_Nullable blockedUser , SBDError *_Nullable error ))completionHandler

Parameters

user

The user to be blocked.

completionHandler

The handler block to execute. blockedUser is the blocked user by the current user.

Declared In

SBDMain.h

+ unblockUserId:completionHandler:

Unblocks the specified user.

+ (void)unblockUserId:(NSString *_Nonnull)userId completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

Parameters

userId

The user ID which was blocked.

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ unblockUser:completionHandler:

Unblocks the specified user.

+ (void)unblockUser:(SBDUser *_Nonnull)user completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

Parameters

user

The user who was blocked.

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ setDoNotDisturbWithEnable:startHour:startMin:endHour:endMin:timezone:completionHandler:

Sets Do-not-disturb. This method make snooze(or stop snooze) repeatedly. If you want to snooze specific period, use setSnoozePeriodEnable:startTimestamp:endTimestamp:completionHandler:].

+ (void)setDoNotDisturbWithEnable:(BOOL)enable startHour:(int)startHour startMin:(int)startMin endHour:(int)endHour endMin:(int)endMin timezone:(NSString *_Nonnull)timezone completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

Parameters

enable

Enables or not.

startHour

Start hour.

startMin

Start minute.

endHour

End hour.

endMin

End minute.

timezone

Sets timezone.

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ getDoNotDisturbWithCompletionHandler:

Gets Do-not-disturb.

+ (void)getDoNotDisturbWithCompletionHandler:(nullable void ( ^ ) ( BOOL isDoNotDisturbOn , int startHour , int startMin , int endHour , int endMin , NSString *_Nonnull timezone , SBDError *_Nullable error ))completionHandler

Parameters

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ setSnoozePeriodEnable:startTimestamp:endTimestamp:completionHandler:

Makes a current user snooze/receive remote push notification in specific duration. If you use [SBDMain setDoNotDisturbWithEnable:startHour:startMin:endHour:endMin:timezone:completionHandler:] method as well, both methods are applied together. Keep in mind snoozing(or stop snoozing) is applied from this method only once, not repeatedly. If you want to snooze(do not disturb) repeatedly, use [SBDMain setDoNotDisturbWithEnable:startHour:startMin:endHour:endMin:timezone:completionHandler:].

+ (void)setSnoozePeriodEnable:(BOOL)enabled startTimestamp:(long long)startTimestamp endTimestamp:(long long)endTimestamp completionHandler:(nullable SBDErrorHandler)completionHandler

Parameters

enabled

Enabled means snooze remote push notification in duration. If set to disabled, current user can receive remote push notification.

startTimestamp

Unix timestamp to start snooze.

endTimestamp

Unix timestamp to end snooze.

completionHandler

The handler block to execute when setting notification snoozed is complete.

Availability

3.0.128

Declared In

SBDMain.h

+ getSnoozePeriod:

Requests whether the current user snooze remote push notification.

+ (void)getSnoozePeriod:(nonnull SBDSnoozePeriodHandler)completionHandler

Parameters

completionHandler

The handler block to execute when setting notification snoozed is complete.

Availability

3.0.128

Declared In

SBDMain.h

+ setPushTriggerOption:completionHandler:

Changes a setting that decides which push notification for the current user to receive in all of the group channel.

+ (void)setPushTriggerOption:(SBDPushTriggerOption)pushTriggerOption completionHandler:(nullable SBDErrorHandler)completionHandler

Parameters

pushTriggerOption

The options to choose which push notification for the current user to receive.

completionHandler

The handler block to execute when setting a push trigger option of the current user is completed.

Availability

3.0.128

Declared In

SBDMain.h

+ getPushTriggerOptionWithCompletionHandler:

Requests a setting that decides which push notification for the current user to receive in all of the group channel.

+ (void)getPushTriggerOptionWithCompletionHandler:(nonnull SBDPushTriggerOptionHandler)completionHandler

Parameters

completionHandler

The handler block to execute when getting a push trigger of the current user is completed.

Availability

3.0.128

Declared In

SBDMain.h

+ setPushSound:completionHandler:

Sets push sound

+ (void)setPushSound:(NSString *_Nonnull)sound completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

Parameters

sound

Push sound

completionHandler

The handler block to be executed after set push sound. This block has no return value and takes an argument that is an error made when there is something wrong to set it.

Declared In

SBDMain.h

+ getPushSoundWithCompletionHandler:

Gets push shound

+ (void)getPushSoundWithCompletionHandler:(nullable void ( ^ ) ( NSString *_Nullable sound , SBDError *_Nullable error ))completionHandler

Parameters

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ setPushTemplateWithName:completionHandler:

Sets a push template of the current user.

+ (void)setPushTemplateWithName:(NSString *_Nonnull)name completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

Parameters

name

The name of push template. It can be SBD_PUSH_TEMPLATE_DEFAULT or SBD_PUSH_TEMPLATE_ALTERNATIVE.

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ getPushTemplateWithCompletionHandler:

Gets a push template of the current user.

+ (void)getPushTemplateWithCompletionHandler:(nullable void ( ^ ) ( NSString *_Nullable name , SBDError *_Nullable error ))completionHandler

Parameters

completionHandler

The handler block to execute. The name is the current user’s push template.

Declared In

SBDMain.h

+ reconnect

Starts reconnection explictly. The SBDConnectionDelegate delegates will be invoked by the reconnection process.

+ (BOOL)reconnect

Return Value

Returns YES if there is the data to be used for reconnection.

Declared In

SBDMain.h

+ getMimeType:

Gets mime type of file.

+ (nullable NSString *)getMimeType:(NSData *_Nullable)file

Parameters

file

File to get mime type.

Return Value

Returns mime type of the file.

Declared In

SBDMain.h

+ setNetworkAwarenessReconnection:

Turns on or off the reconnection by network awareness.

+ (void)setNetworkAwarenessReconnection:(BOOL)onOff

Parameters

onOff

If YES, the reconnection by network Awareness is turned.

Declared In

SBDMain.h

+ setChannelInvitationPreferenceAutoAccept:completionHandler:

Sets group channel invitation preference for auto acceptance.

+ (void)setChannelInvitationPreferenceAutoAccept:(BOOL)autoAccept completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

Parameters

autoAccept

If YES, the current user will accept the group channel invitation automatically.

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ getChannelInvitationPreferenceAutoAcceptWithCompletionHandler:

Gets group channel inviation preference for auto acceptance.

+ (void)getChannelInvitationPreferenceAutoAcceptWithCompletionHandler:(nullable void ( ^ ) ( BOOL autoAccept , SBDError *_Nullable error ))completionHandler

Parameters

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ addUserEventDelegate:identifier:

+ (void)addUserEventDelegate:(id<SBDUserEventDelegate> _Nonnull)delegate identifier:(NSString *_Nonnull)identifier

+ removeUserEventDelegateForIdentifier:

+ (void)removeUserEventDelegateForIdentifier:(NSString *_Nonnull)identifier

+ removeAllUserEventDelegates

+ (void)removeAllUserEventDelegates

+ createFriendListQuery

+ (nullable SBDFriendListQuery *)createFriendListQuery

+ addFriendsWithUserIds:completionHandler:

+ (void)addFriendsWithUserIds:(NSArray<NSString*> *_Nonnull)userIds completionHandler:(nullable void ( ^ ) ( NSArray<SBDUser*> *_Nullable users , SBDError *_Nullable error ))completionHandler

+ deleteFriendWithUserId:completionHandler:

+ (void)deleteFriendWithUserId:(NSString *_Nonnull)userId completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

+ deleteFriendsWithUserIds:completionHandler:

+ (void)deleteFriendsWithUserIds:(NSArray<NSString*> *_Nonnull)userIds completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

+ deleteFriendWithDiscovery:completionHandler:

+ (void)deleteFriendWithDiscovery:(NSString *_Nonnull)discoveryKey completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

+ deleteFriendsWithDiscoveries:completionHandler:

+ (void)deleteFriendsWithDiscoveries:(NSArray<NSString*> *_Nonnull)discoveryKeys completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

+ uploadFriendDiscoveries:completionHandler:

+ (void)uploadFriendDiscoveries:(NSDictionary<NSString*,NSString*> *_Nonnull)discoveryKeyAndNames completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

+ getFriendChangeLogsByToken:completionHandler:

+ (void)getFriendChangeLogsByToken:(NSString *_Nullable)token completionHandler:(nullable void ( ^ ) ( NSArray<SBDUser*> *_Nullable updatedUsers , NSArray<NSString*> *_Nullable deletedUserIds , BOOL hasMore , NSString *_Nullable token , SBDError *_Nullable error ))completionHandler

+ markAsReadAllWithCompletionHandler:

Marks as read all group channels of the current user.

+ (void)markAsReadAllWithCompletionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

Parameters

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ markAsReadWithChannelUrls:completionHandler:

Marks as read some group channels of the current user.

+ (void)markAsReadWithChannelUrls:(NSArray<NSString*> *_Nonnull)channelUrls completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

Parameters

channelUrls

The array list with channel urls to be marked as read.

completionHandler

The handler block to execute.

Declared In

SBDMain.h

+ getChannelCountWithMemberStateFilter:completionHandler:

Gets the number of group channel with the filter.

+ (void)getChannelCountWithMemberStateFilter:(SBDMemberStateFilter)memberStateFilter completionHandler:(nonnull void ( ^ ) ( NSUInteger groupChannelCount , SBDError *_Nullable error ))completionHandler

Parameters

memberStateFilter

The member state of the current user in the channels that are counted.

completionHandler

The handler block to execute.

Availability

3.0.116

Declared In

SBDMain.h

+ getTotalUnreadChannelCountWithCompletionHandler:

Gets the total unread channel count of all group channels.

+ (void)getTotalUnreadChannelCountWithCompletionHandler:(nonnull void ( ^ ) ( NSUInteger unreadCount , SBDError *_Nullable error ))completionHandler

Parameters

completionHandler

The handler block to execute. The unreadCount is the total count of unread channels in all of group channel which the current is a member.

Availability

3.0.116

Declared In

SBDMain.h

+ getTotalUnreadMessageCountWithCompletionHandler:

Gets the number of unread messages in group channels.

+ (void)getTotalUnreadMessageCountWithCompletionHandler:(nullable void ( ^ ) ( NSUInteger unreadCount , SBDError *_Nullable error ))completionHandler

Parameters

completionHandler

The handler block to execute. The unreadCount is the total count of unread messages in all of group channel which the current is a member.

Availability

3.0.116

Declared In

SBDMain.h

+ getTotalUnreadMessageCountWithParams:completionHandler:

Gets the total unread message count of the channels with filters of params.

+ (void)getTotalUnreadMessageCountWithParams:(nonnull SBDGroupChannelTotalUnreadMessageCountParams *)params completionHandler:(nonnull void ( ^ ) ( NSUInteger unreadCount , SBDError *_Nullable error ))completionHandler

Parameters

params

The instance of parameters to filter.

completionHandler

The handler block to be executed after getting total unread message count. This block has no return value and takes two argument, the one is the number of unread message and the other is error.

Availability

3.0.116

Declared In

SBDMain.h

+ getUnreadItemCountWithKey:completionHandler:

Get unread counts of message and invitation counts in super and non_super channels.

+ (void)getUnreadItemCountWithKey:(SBDUnreadItemKey)key completionHandler:(nonnull void ( ^ ) ( SBDUnreadItemCount *_Nullable count , SBDError *_Nullable error ))completionHandler

Parameters

key

bitmask key composed of super/non_super unread message count, super/non_super invitation count.

completionHandler

The handler block to be executed after getting unread item count. This block has no return value and takes two argument. the one is type of SBDUnreadItemCount that contains unsinged interger for count you requested. the other is an error made when there is something wrong to response.

Availability

3.0.116

Declared In

SBDMain.h

+ getSubscribedTotalUnreadMessageCount

+ (NSInteger)getSubscribedTotalUnreadMessageCount

+ getSubscribedCustomTypeTotalUnreadMessageCount

+ (NSInteger)getSubscribedCustomTypeTotalUnreadMessageCount

+ getSubscribedCustomTypeUnreadMessageCountWithCustomType:

+ (NSInteger)getSubscribedCustomTypeUnreadMessageCountWithCustomType:(nonnull NSString *)customType

+ getMyGroupChannelChangeLogsByToken:customTypes:completionHandler:

Requests updated channels and deleted channel URLs since a certain time. A certain time is decided by a token. And the results contain empty channels.

+ (void)getMyGroupChannelChangeLogsByToken:(nullable NSString *)token customTypes:(nullable NSArray<NSString*> *)customTypes completionHandler:(nonnull SBDChannelChangeLogsHandler)completionHandler

Parameters

token

The token used to get next pagination of changelogs.

customTypes

The list of custom types to request. If not set, requests my group channels regardless of custom type.

completionHandler

The handler type of SBDChannelChangeLogsHandler block to execute. The updatedChannels is the channels that were updated. The deletedChannelUrls is the list of the deleted channel URLs. If there are more changelogs that are not returned yet, the hasMore is YES. The token can be used to get more changedlogs.

Availability

3.0.123

Declared In

SBDMain.h

+ getMyGroupChannelChangeLogsByToken:customTypes:includeEmptyChannel:completionHandler:

Requests updated channels and deleted channel URLs since a certain time. A certain time is decided by a token.

+ (void)getMyGroupChannelChangeLogsByToken:(nullable NSString *)token customTypes:(nullable NSArray<NSString*> *)customTypes includeEmptyChannel:(BOOL)includeEmptyChannel completionHandler:(nonnull SBDChannelChangeLogsHandler)completionHandler

Parameters

token

The token used to get next pagination of changelogs.

customTypes

The list of custom types to request. If not set, requests my group channels regardless of custom type.

includeEmptyChannel

Bool value that filters a result whether include empty channels, not contained any messages.

completionHandler

The handler type of SBDChannelChangeLogsHandler block to execute. The updatedChannels is the channels that were updated. The deletedChannelUrls is the list of the deleted channel URLs. If there are more changelogs that are not returned yet, the hasMore is YES. The token can be used to get more changedlogs.

Availability

3.0.131

Declared In

SBDMain.h

+ getMyGroupChannelChangeLogsByTimestamp:customTypes:completionHandler:

Requests updated channels and deleted channel URLs since the timestamp. And the results contain empty channels.

+ (void)getMyGroupChannelChangeLogsByTimestamp:(long long)timestamp customTypes:(nullable NSArray<NSString*> *)customTypes completionHandler:(nonnull SBDChannelChangeLogsHandler)completionHandler

Parameters

timestamp

The number of milli-seconds(msec). Requests changelogs from that time. This value must not be negative.

customTypes

The list of custom types to request. If not set, requests all of my group channels.

completionHandler

The handler type of SBDChannelChangeLogsHandler block to execute. The updatedChannels is the channels that were updated. The deletedChannelUrls is the list of the deleted channel URLs. If there are more changelogs that are not returned yet, the hasMore is YES. The token can be used to get more changedlogs.

Availability

3.0.123

Declared In

SBDMain.h

+ getMyGroupChannelChangeLogsByTimestamp:customTypes:includeEmptyChannel:completionHandler:

Requests updated channels and deleted channel URLs since the timestamp.

+ (void)getMyGroupChannelChangeLogsByTimestamp:(long long)timestamp customTypes:(nullable NSArray<NSString*> *)customTypes includeEmptyChannel:(BOOL)includeEmptyChannel completionHandler:(nonnull SBDChannelChangeLogsHandler)completionHandler

Parameters

timestamp

The number of milli-seconds(msec). Requests changelogs from that time. This value must not be negative.

customTypes

The list of custom types to request. If not set, requests all of my group channels.

includeEmptyChannel

Bool value that filters a result whether include empty channels, not contained any messages.

completionHandler

The handler type of SBDChannelChangeLogsHandler block to execute. The updatedChannels is the channels that were updated. The deletedChannelUrls is the list of the deleted channel URLs. If there are more changelogs that are not returned yet, the hasMore is YES. The token can be used to get more changedlogs.

Availability

3.0.131

Declared In

SBDMain.h