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 operations. The methods include SBDChannelDelegate registration for receiving events that 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

+ setAppVersion:

Sets the version of the app that uses the Sendbird SDK. The version will be used when the debugging is needed.

+ (void)setAppVersion:(nullable NSString *)appVersion

Parameters

appVersion

The version of the app.

Availability

3.1.3

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

+ initWithApplicationId:useCaching:migrationStartHandler:completionHandler:

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:(nullable NSString *)applicationId useCaching:(BOOL)useCaching migrationStartHandler:(nullable void ( ^ ) ( void ))migrationStartHandler completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

Parameters

applicationId

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

useCaching

If YES, the local cache is set.

migrationStartHandler

// TODO:

completionHandler

// TODO:

Return Value

If YES, the applicationId is set.

Availability

3.0.227

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. Internal use only.

+ (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

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: 3.0.120. (Use createApplicationUserListQuery instead.))

+ (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: 3.0.120. (Use createApplicationUserListQuery and userIdsFilter of SBDApplicationUserListQuery instead.))

+ (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

+ updateCurrentUserInfoWithPreferredLanguages:completionHandler:

Updates the current user’s preferred languages

+ (void)updateCurrentUserInfoWithPreferredLanguages:(nonnull NSArray<NSString*> *)preferredLanguages completionHandler:(nullable SBDErrorHandler)completionHandler

Parameters

preferredLanguages

New array of preferred languages

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: 3.0.22. (Use registerDevicePushToken:unique:completionHandler: instead.))

+ (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: 3.0.9. (Use registerDevicePushToken:unique:completionHandler: instead.))

+ (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

+ userEventDelegateForIdentifier:

+ (nullable id<SBDUserEventDelegate>)userEventDelegateForIdentifier:(NSString *_Nonnull)identifier

+ 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

+ setAllowFriendDiscovery:completionHandler:

Sets current user to be discoverable by others

+ (void)setAllowFriendDiscovery:(BOOL)allow completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

Parameters

allow

if YES, current user will be set to discoverable by others

Availability

3.0.205

Declared In

SBDMain.h

+ getAllowFriendDiscoveryWithCompletionHandler:

Gets a flag whether current user is discoverable or not by others

+ (void)getAllowFriendDiscoveryWithCompletionHandler:(nullable void ( ^ ) ( BOOL allowed , SBDError *_Nullable error ))completionHandler

Availability

3.0.205

Declared In

SBDMain.h

+ 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 group channels of which the current user is a member.

Availability

3.0.116

Declared In

SBDMain.h

+ getTotalUnreadChannelCountWithParams:completionHandler:

Gets the total unread channel count of all group channels with filters of params.

+ (void)getTotalUnreadChannelCountWithParams:(nullable SBDGroupChannelTotalUnreadChannelCountParams *)params completionHandler:(nonnull void ( ^ ) ( NSUInteger unreadCount , SBDError *_Nullable error ))completionHandler

Parameters

params

The instance of parameters to filter.

completionHandler

The handler block to execute. The unreadCount is the total count of unread group channels of which the current user is a member, filtered by params.

Availability

3.1.7

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 user 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

+ markAsDeliveredWithChannelUrl:

Marks as delivered a group channel of the current user. (Deprecated: 3.0.185.)

+ (void)markAsDeliveredWithChannelUrl:(nonnull NSString *)channelUrl

Parameters

channelUrl

The channel URL.

Availability

3.0.162

Discussion

Note: The client doesn’t have to call this method any longer.

Declared In

SBDMain.h

+ 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. (Deprecated: 3.0.182 Use getMyGroupChannelChangeLogsByToken:params:completionHandler instead)

+ (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. (Deprecated: 3.0.182. (Use getMyGroupChannelChangeLogsByToken:params:completionHandler instead.))

+ (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

+ getMyGroupChannelChangeLogsByToken:params: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 params:(nullable SBDGroupChannelChangeLogsParams *)params completionHandler:(nonnull SBDChannelChangeLogsHandler)completionHandler

Parameters

token

The token used to get next pagination of changelogs.

params

the parameter object that filters a result. See SBDGroupChannelChangeLogsParams for more detail

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.182

Declared In

SBDMain.h

+ getMyGroupChannelChangeLogsByTimestamp:customTypes:completionHandler:

Requests updated channels and deleted channel URLs since the timestamp. And the results contain empty channels. (Deprecated: 3.0.182. (Use getMyGroupChannelChangeLogsByTimestamp:params:completionHandler instead.))

+ (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. (Deprecated: 3.0.182. (Use getMyGroupChannelChangeLogsByTimestamp:params:completionHandler instead.))

+ (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

+ getMyGroupChannelChangeLogsByTimestamp:params:completionHandler:

Requests updated channels and deleted channel URLs since the timestamp.

+ (void)getMyGroupChannelChangeLogsByTimestamp:(long long)timestamp params:(nullable SBDGroupChannelChangeLogsParams *)params completionHandler:(nonnull SBDChannelChangeLogsHandler)completionHandler

Parameters

timestamp

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

params

the parameter object that filters a result. See SBDGroupChannelChangeLogsParams for more detail

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.182

Declared In

SBDMain.h

+ getAllEmojis:

Requests a emoji container which contains hash and list of emoji category.

+ (void)getAllEmojis:(nullable void ( ^ ) ( SBDEmojiContainer *_Nullable container , SBDError *_Nullable error ))completionHandler

Parameters

completionHandler

The handler block to execute after request is completed

Availability

3.0.180

Declared In

SBDMain.h

+ getEmoji:completionHandler:

Requests updated channels and deleted channel URLs since the timestamp.

+ (void)getEmoji:(nonnull NSString *)emojiKey completionHandler:(nullable void ( ^ ) ( SBDEmoji *_Nullable emoji , SBDError *_Nullable error ))completionHandler

Parameters

emojiKey

The emoji key

completionHandler

The handler block to execute after request is completed

Availability

3.0.180

Declared In

SBDMain.h

+ getEmojiCategory:completionHandler:

Requests updated channels and deleted channel URLs since the timestamp.

+ (void)getEmojiCategory:(long long)categoryId completionHandler:(nullable void ( ^ ) ( SBDEmojiCategory *_Nullable category , SBDError *_Nullable error ))completionHandler

Parameters

categoryId

The category id

completionHandler

The handler block to execute after request is completed

Availability

3.0.180

Declared In

SBDMain.h

+ getSBUserAgent

Sendbird user agent information getter.

+ (nonnull NSString *)getSBUserAgent

Declared In

SBDMain.h

+ addExtension:version:

Used to set the version information of the Sendbird SDK extension.

+ (void)addExtension:(nonnull NSString *)key version:(nonnull NSString *)version

Parameters

key

Extension sdk’s hidden key

version

Extension sdk’s version string

Declared In

SBDMain.h

+ getAppInfo

Gets information set in the Application.

+ (nullable SBDAppInfo *)getAppInfo

Availability

3.0.180

Declared In

SBDMain.h

+ setAppGroup:

Sets the app group.

+ (void)setAppGroup:(nonnull NSString *)appGroup

Parameters

appGroup

The app group.

Availability

3.0.183

Declared In

SBDMain.h

+ markAsDeliveredWithRemoteNotificationPayload:completionHandler:

Marks as delivered with the payload of the remote notification.

+ (void)markAsDeliveredWithRemoteNotificationPayload:(nonnull NSDictionary *)payload completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

Parameters

payload

The remote notification payload

completionHandler

The handler block to execute

Availability

3.0.183

Declared In

SBDMain.h

+ ekey

Gets the key to authenticate the file URL. This has to be put into the HTTP header when the client needs to access it.

+ (nullable NSString *)ekey

Return Value

The key to authenticate the file URL

Availability

3.0.194

Declared In

SBDMain.h

+ setSessionDelegate:

+ (void)setSessionDelegate:(id<SBDSessionDelegate> _Nonnull)delegate

+ removeSessionDelegate

+ (void)removeSessionDelegate

+ isUsingLocalCaching

3.1.0

+ (BOOL)isUsingLocalCaching

Availability

3.1.0

Declared In

SBDMain.h

+ clearCachedDataWithCompletionHandler:

3.1.0

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

Availability

3.1.0

Declared In

SBDMain.h

+ getCachedDataSize

3.1.0

+ (NSUInteger)getCachedDataSize

Availability

3.1.0

Declared In

SBDMain.h

+ clearCachedMessages:completionHandler:

3.1.0

+ (void)clearCachedMessages:(nonnull NSString *)channelUrl completionHandler:(nullable void ( ^ ) ( SBDError *_Nullable error ))completionHandler

Availability

3.1.0

Declared In

SBDMain.h