SendbirdChat
public final class SendbirdChat: NSObject
The SendbirdChat 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 BaseChannelDelegate registration for receiving events
that are related to channels, ConnectionDelegate for managing the connection status, updating the current user’s information,
registration for APNS push notification and blocking other users.
-
Gets initializing state.
Declaration
Swift
public static var isInitialized: BoolReturn Value
If
true,SendbirdChatinstance is initialized. -
Retrieves the SDK version.
Declaration
Swift
public static func getSDKVersion() -> StringReturn Value
The SDK version.
-
Gets the Application ID which was used for initialization.
Declaration
Swift
public static func getApplicationId() -> String?Return Value
The Application ID.
-
Sets the version of the app that uses the Sendbird SDK. The version will be used when the debugging is needed.
Since
3.1.3Declaration
Swift
public static func setAppVersion(version: String?)Parameters
versionThe version of the app.
-
Gets the maximum number of files in a
MultipleFilesMessage.Since
4.9.1Declaration
Swift
public static func getMultipleFilesMessageFileCountLimit() -> IntReturn Value
multipleFilesMessageFileCountLimit
-
Initializes
SendbirdChatsingleton instance with Sendbird Application ID.The Application ID is on Sendbird dashboard. This method has to be run first in order to user Sendbird.
Since
3.0.227Declaration
Swift
public static func initialize( params: InitParams, migrationStartHandler: VoidHandler? = nil, completionHandler: SBErrorHandler? = nil ) -> BoolParameters
paramsInitParamsobjectmigrationStartHandlerhandler that notifies when local cache migration has started
completionHandlerhandler that notifies when local cache is ready to use
Return Value
trueif the applicationId is set. -
Synchronously initializes
SendbirdChatsingleton instance with Sendbird Application ID.The Application ID is on Sendbird dashboard. This method has to be run first in order to user Sendbird.
Since
4.0.15Declaration
Swift
@available(*, deprecated, renamed: "initialize(params:migrationStartHandler:completionHandler:﹚", message: "This method is deprecated in 4.15.0. Set `needsSynchronous` in `InitParams` to `true` and use `initialize(params:migrationStartHandler:completionHandler:﹚` instead.") public static func initializeSynchronously(params: InitParams) -> SBError?Parameters
paramsInitParamsobjectReturn Value
nilif the applicationId is set, otherwiseSBError -
Executes a given handler immediately if the SDK is already initialized, or waits for its initialization to complete before execution.
This function checks the initialization state of the SDK. If the component is already in the
.completedstate, theexecuteHandleris called immediately. If the component is not yet initialized, the function waits until the initialization state changes to.completedbefore calling theexecuteHandler.Important
This function MUST be set after
SendbirdChat.initializeto work.Usage Example:
executeOrWaitForInitialization { // Code to run when already initialized or to run after initialization }Since
4.15.0Declaration
Swift
public static func executeOrWaitForInitialization(executeHandler: @escaping () -> Void)Parameters
executeHandlerA closure to be executed. This closure takes no parameters and returns void. It contains the code that should be executed once the SDK is initialized.
-
Performs a connection to Sendbird with the user ID.
Declaration
Swift
public static func connect( userId: String, completionHandler: UserHandler? = nil )Parameters
userIdThe user ID.
completionHandlerThe handler block to execute.
useris the object to represent the current user. -
Performs a connection to Sendbird with the user ID and the access token.
Declaration
Swift
public static func connect( userId: String, authToken: String?, completionHandler: UserHandler? = nil )Parameters
userIdThe user ID.
authTokenThe auth token. If the user doesn’t have auth token, set nil.
completionHandlerThe handler block to execute.
useris the object to represent the current user. -
Performs a connection to Sendbird with the user ID and the access token.
Declaration
Swift
public static func connect( userId: String, authToken: String?, apiHost: String?, wsHost: String?, completionHandler: UserHandler? = nil )Parameters
userIduser ID
authTokenauthToken
apiHostapiHost. Internal use only.
wsHostwsHost. Internal use only.
completionHandlercompletionHandler
-
Authenticate with the Sendbird server. Calling this method will grant you access to Sendbird Business Messaging’s features. If you want to access Sendbird Chat’s features, call
SendbirdChat.connect. You can deauthenticate from the Sendbird server by callingSendbirdChat.disconnect.Note
Use thedisconnect(completionHandler:)method to deauthenticate.Since
4.10.0Declaration
Swift
@available(*, deprecated, renamed: "authenticate") public static func authenticateFeed( userId: String, authToken: String?, completionHandler: UserHandler? = nil )Parameters
userIdThe user ID.
authTokenThe auth token. If the user doesn’t have auth token, set nil.
completionHandlerThe handler block to execute.
useris the object to represent the current user. -
Authenticate with the Sendbird server. Calling this method will grant you access to Sendbird Business Messaging’s features. If you want to access Sendbird Chat’s features, call
SendbirdChat.connect. You can deauthenticate from the Sendbird server by callingSendbirdChat.disconnect.Note
Use thedisconnect(completionHandler:)method to deauthenticate.Since
4.10.0Declaration
Swift
@available(*, deprecated, renamed: "authenticate") public static func authenticateFeed( userId: String, authToken: String?, apiHost: String?, completionHandler: UserHandler? = nil )Parameters
userIdThe user ID.
authTokenThe auth token. If the user doesn’t have auth token, set nil.
apiHostapiHost
completionHandlerThe handler block to execute.
useris the object to represent the current user. -
Authenticate with the Sendbird server. Calling this method will grant you access to Sendbird Business Messaging’s features. If you want to access Sendbird Chat’s features, call
SendbirdChat.connect. You can deauthenticate from the Sendbird server by callingSendbirdChat.disconnect.Note
Use thedisconnect(completionHandler:)method to deauthenticate.Since
4.19.8Declaration
Swift
public class func authenticate( userId: String, authToken: String?, apiHost: String? = nil, completionHandler: UserHandler? = nil )Parameters
userIdThe user ID.
authTokenThe auth token. If the user doesn’t have auth token, set nil.
apiHostapiHost
completionHandlerThe handler block to execute.
useris the object to represent the current user. -
Disconnects from Sendbird. If this method is invoked, the current user will be invalidated.
Declaration
Swift
public static func disconnect(completionHandler: VoidHandler? = nil)Parameters
completionHandlerThe handler block to execute.
-
Disconnects WebSocket only.
Since
4.4.0Declaration
Swift
public static func disconnectWebSocket(completionHandler: VoidHandler? = nil)Parameters
completionHandlerThe handler block to execute.
-
Starts reconnection explictly. The
ConnectionDelegatedelegates will be invoked by the reconnection process.Declaration
Swift
public static func reconnect() -> BoolReturn Value
trueif there is the data to be used for reconnection. -
The completion handler of background session.
Declaration
Swift
public static var backgroundSessionCompletionHandler: VoidHandler? -
Gets information set in the Application.
Since
3.0.180Declaration
Swift
public static func getAppInfo() -> AppInfo? -
Gets the WebSocket server connection state.
Declaration
Swift
public static func getConnectState() -> WebSocketConnectionStateReturn Value
WebSocketConnectionStateindicating socket connection state -
Creates
ApplicationUserListQueryinstance for getting a list of all users of this application.Since
3.0.120Declaration
Swift
public static func createApplicationUserListQuery() -> ApplicationUserListQueryReturn Value
ApplicationUserListQueryinstance. -
Creates
ApplicationUserListQueryinstance for getting a list of all users of this application.Since
3.0.120Declaration
Swift
public static func createApplicationUserListQuery( paramsBuilder: (ApplicationUserListQueryParams) -> Void ) -> ApplicationUserListQueryParameters
paramsBuilderThe builder closure for setting
ApplicationUserListQueryParams.Return Value
ApplicationUserListQueryinstance. -
Creates
ApplicationUserListQueryinstance for getting a list of all users of this application.Since
3.0.120Declaration
Swift
public static func createApplicationUserListQuery( params: ApplicationUserListQueryParams ) -> ApplicationUserListQueryParameters
paramsApplicationUserListQueryParamsinstance.Return Value
ApplicationUserListQueryinstance. -
Creates
BlockedUserListQueryinstance for getting a list of blocked users by the current user.Declaration
Swift
public static func createBlockedUserListQuery() -> BlockedUserListQueryReturn Value
BlockedUserListQueryinstance. -
Creates
BlockedUserListQueryinstance for getting a list of blocked users by the current user.Declaration
Swift
public static func createBlockedUserListQuery( paramsBuilder: (BlockedUserListQueryParams) -> Void ) -> BlockedUserListQueryParameters
paramsBuilderThe builder closure for setting
BlockedUserListQueryParams.Return Value
BlockedUserListQueryinstance. -
Creates
BlockedUserListQueryinstance for getting a list of blocked users by the current user.Declaration
Swift
public static func createBlockedUserListQuery(params: BlockedUserListQueryParams) -> BlockedUserListQueryParameters
paramsBlockedUserListQueryParamsinstance.Return Value
BlockedUserListQueryinstance. -
Creates
MessageSearchQueryinstance for message searchSince
4.0.0Declaration
Swift
public static func createMessageSearchQuery(builder: (MessageSearchQueryParams) -> Void) -> MessageSearchQueryParameters
builderThe builder closure for setting
MessageSearchQueryParamsReturn Value
MessageSearchQueryinstance -
Creates
MessageSearchQueryinstance for message searchSince
4.0.0Declaration
Swift
public static func createMessageSearchQuery(params: MessageSearchQueryParams) -> MessageSearchQueryParameters
paramsThe params object to change query condition.
Return Value
MessageSearchQueryinstance
-
Adds a
ConnectionDelegate.Declaration
Swift
@available(*, deprecated, renamed: "addConnectionDelegate(_:identifier:﹚", message: "This method is deprecated in 4.0.12.") public static func add(_ delegate: ConnectionDelegate, identifier: String)Parameters
delegateConnectionDelegatedelegate.identifierThe identifier for the delegate.
-
Adds a
ConnectionDelegate.Since
4.0.12Declaration
Swift
public static func addConnectionDelegate(_ delegate: ConnectionDelegate, identifier: String)Parameters
delegateConnectionDelegatedelegate.identifierThe identifier for the delegate.
-
Removes the
ConnectionDelegateby identifier.Declaration
Swift
public static func removeConnectionDelegate(forIdentifier identifier: String)Parameters
identifierThe identifier for the delegate to be removed.
-
Gets the delegate for connection by indentifer.
Declaration
Swift
public static func connectionDelegate( forIdentifier identifier: String ) -> ConnectionDelegate?Parameters
identifierThe identifier for delegate.
Return Value
ConnectionDelegatedelegate. -
Removes all connection delegates;
Declaration
Swift
public static func removeAllConnectionDelegates() -
Adds a
BaseChannelDelegate.Declaration
Swift
@available(*, deprecated, renamed: "addChannelDelegate(_:identifier:﹚", message: "This method is deprecated in 4.0.12.") public static func add(_ delegate: BaseChannelDelegate, identifier: String)Parameters
delegateBaseChannelDelegatedelegate.identifierThe identifier for delegate.
-
Adds a
BaseChannelDelegate.Since
4.0.12Declaration
Swift
public static func addChannelDelegate(_ delegate: BaseChannelDelegate, identifier: String)Parameters
delegateBaseChannelDelegatedelegate.identifierThe identifier for delegate.
-
Removes the
BaseChannelDelegateby identifier.Declaration
Swift
public static func removeChannelDelegate(forIdentifier identifier: String)Parameters
identifierThe identifier for the delegate to be removed.
-
Gets the delegate for channel by indentifer.
Declaration
Swift
public static func channelDelegate( forIdentifier identifier: String ) -> BaseChannelDelegate?Parameters
identifierThe identifier for delegate.
Return Value
BaseChannelDelegatedelegate. -
Removes all channel delegates
Declaration
Swift
public static func removeAllChannelDelegates() -
Gets a
UserEventDelegateDeclaration
Swift
public static func userEventDelegate( forIdentifier identifier: String ) -> UserEventDelegate?Parameters
identifierIdentifier for delegate
Return Value
UserEventDelgateif exists -
Adds a
UserEventDelegateDeclaration
Swift
@available(*, deprecated, renamed: "addUserEventDelegate(_:identifier:﹚", message: "This method is deprecated in 4.0.12.") public static func add(_ delegate: UserEventDelegate, identifier: String)Parameters
delegateUserEventDelegateinstanceidentifierString identifier for the delegate
-
Adds a
UserEventDelegateSince
4.0.12Declaration
Swift
public static func addUserEventDelegate(_ delegate: UserEventDelegate, identifier: String)Parameters
delegateUserEventDelegateinstanceidentifierString identifier for the delegate
-
Removes a
UserEventDelegateDeclaration
Swift
public static func removeUserEventDelegate(forIdentifier identifier: String)Parameters
identifierString identifier for the delegate
-
Removes all registered user event delegates
Declaration
Swift
public static func removeAllUserEventDelegates() -
Adds a
SessionDelegateDeclaration
Swift
public static func setSessionDelegate(_ delegate: SessionDelegate)Parameters
delegateSessionDelegateinstance -
Removes the
SessionDelegateDeclaration
Swift
public static func removeSessionDelegate()
-
Gets the pending push token.
Declaration
Swift
public static func getPendingPushToken() -> Data?Return Value
Returns the pending push token.
-
Registers the current device token to Sendbird.
Declaration
Swift
public static func registerDevicePushToken( _ devToken: Data, unique: Bool, completionHandler: ((_ registrationStatus: PushTokenRegistrationStatus, _ error: SBError?) -> Void)? = nil )Parameters
devTokenDevice token for APNS.
uniqueIf
true, register device token after removing exsiting all device tokens of the current user. Iffalse, just add the device token.completionHandlerThe handler block to execute.
statusis the status for push token registration. It is defined inPushTokenRegistrationStatus..successrepresents thedevTokenis registered..pendingrepresents thedevTokenis not registered because the connection is not established, so this method has to be invoked withgetPendingPushTokenmethod after the connection. ThedevTokenis retrived bygetPendingPushToken..errorrepresents the push token registration is failed. -
Unregisters the current device token from Sendbird.
Declaration
Swift
@available(*, deprecated, message: "This method is deprecated in 4.2.4. Please use `unregisterPushToken(_ pushToken: Data, completionHandler: SBErrorHandler?﹚`") public static func unregisterPushToken( _ devToken: Data, completionHandler: ((_ response: [AnyHashable: Any]?, _ error: SBError?) -> Void)? = nil )Parameters
devTokenDevice token for APNS.
completionHandlerThe handler block to execute.
-
Unregisters the current device token from Sendbird.
Declaration
Swift
public static func unregisterPushToken( _ pushToken: Data, completionHandler: SBErrorHandler? = nil )Parameters
pushTokenDevice token for APNS.
completionHandlerThe handler block to execute.
-
Unregisters all device tokens for the current user from Sendbird.
Declaration
Swift
@available(*, deprecated, message: "This method is deprecated in 4.2.4. Please use `unregisterAllPushToken(completionHandler: SBErrorHandler?﹚`") public static func unregisterAllPushToken( completionHandler: ((_ response: [AnyHashable: Any]?, _ error: SBError?) -> Void)? = nil )Parameters
completionHandlerThe handler block to execute.
-
Unregisters all device tokens for the current user from Sendbird.
Declaration
Swift
public static func unregisterAllPushToken( completionHandler: SBErrorHandler? = nil )Parameters
completionHandlerThe handler block to execute.
-
Requests device push tokens list of current user after the token.
Since
3.0.134Declaration
Swift
public static func getMyPushTokens( token: String?, pushTokenType: PushTokenType, completionHandler: @escaping GetPushTokensHandler )Parameters
tokenThe token used to get next pagination of deive push tokens.
pushTokenTypeThe enum type to represent the type of push token.
completionHandlerThe 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.
-
Sets Do-not-disturb. This method make snooze(or stop snooze) repeatedly. If you want to snooze specific period, use
setSnoozePeriodEnable(:startTimestamp:endTimestamp:completionHandler:).Declaration
Swift
public static func setDoNotDisturb( enable: Bool, startHour: Int32, startMin: Int32, endHour: Int32, endMin: Int32, timezone: String, completionHandler: SBErrorHandler? = nil )Parameters
enableEnables or not.
startHourStart hour.
startMinStart minute.
endHourEnd hour.
endMinEnd minute.
timezoneSets timezone.
completionHandlerThe handler block to execute.
-
Gets Do-not-disturb.
Declaration
Swift
public static func getDoNotDisturb( completionHandler: ((_ enabled: Bool, _ startHour: Int, _ startMin: Int, _ endHour: Int, _ endMin: Int, _ timezone: String, _ error: SBError?) -> Void)? = nil )Parameters
completionHandlerThe handler block to execute.
-
Makes a current user snooze/receive remote push notification in specific duration.
If you use
SendbirdChat setDoNotDisturb(enable: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, useSendbirdChat setDoNotDisturb(enable:startHour:startMin:endHour:endMin:timezone:completionHandler:).Since
3.0.128Declaration
Swift
public static func setSnoozePeriod( enabled: Bool, startTimestamp: Int64, endTimestamp: Int64, completionHandler: SBErrorHandler? = nil )Parameters
enabledEnabled means snooze remote push notification in duration. If set to disabled, current user can ///receive remote push notification.
startTimestampUnix timestamp to start snooze.
endTimestampUnix timestamp to end snooze.
completionHandlerThe handler block to execute when setting notification snoozed is complete.
-
Requests whether the current user snooze remote push notification.
Since
3.0.128Declaration
Swift
public static func getSnoozePeriod( _ completionHandler: @escaping SnoozePeriodHandler )Parameters
completionHandlerThe handler block to execute when setting notification snoozed is complete.
-
Changes a setting that decides which push notification for the current user to receive in all of the group channel.
Since
3.0.128Declaration
Swift
public static func setPushTriggerOption( _ pushTriggerOption: PushTriggerOption, completionHandler: SBErrorHandler? = nil )Parameters
pushTriggerOptionThe options to choose which push notification for the current user to receive.
completionHandlerThe handler block to execute when setting a push trigger option of the current ///user is completed.
-
Requests a setting that decides which push notification for the current user to receive in all of the group channel.
Since
3.0.128Declaration
Swift
public static func getPushTriggerOption( completionHandler: @escaping PushTriggerOptionHandler )Parameters
completionHandlerThe handler block to execute when getting a push trigger of the current user is ///completed.
-
Sets push sound
Declaration
Swift
public static func setPushSound( _ sound: String, completionHandler: SBErrorHandler? = nil )Parameters
soundPush sound
completionHandlerThe handler block to be executed after set push sound.
-
Gets push shound
Declaration
Swift
public static func getPushSound( completionHandler: ((_ pushSound: String?, _ error: SBError?) -> Void)? = nil )Parameters
completionHandlerThe handler block to execute.
-
Sets a push template of the current user.
Declaration
Swift
public static func setPushTemplate( name: String, completionHandler: SBErrorHandler? = nil )Parameters
nameThe name of push template. Uses
SendbirdChat.PushTemplateconstantscompletionHandlerThe handler block to execute.
-
Gets a push template of the current user.
Declaration
Swift
public static func getPushTemplate( completionHandler: ((_ pushTemplate: String?, _ error: SBError?) -> Void)? = nil )Parameters
completionHandlerThe handler block to execute. The
nameis the current user’s push template. -
Sets group channel invitation preference for auto acceptance.
Declaration
Swift
public static func setChannelInvitationPreference( autoAccept: Bool, completionHandler: SBErrorHandler? = nil )Parameters
autoAcceptIf
true, the current user will accept the group channel invitation automatically.completionHandlerThe handler block to execute.
-
Gets group channel inviation preference for auto acceptance.
Declaration
Swift
public static func getChannelInvitationPreferenceAutoAccept( completionHandler: ((_ autoAccept: Bool, _ error: SBError?) -> Void)? = nil )Parameters
completionHandlerThe handler block to execute.
-
Creates
FriendListQueryinstance for friend listSince
4.0.0Declaration
Swift
public static func createFriendListQuery() -> FriendListQueryReturn Value
FriendListQueryinstance -
Creates
FriendListQueryinstance for friend listSince
4.0.0Declaration
Swift
public static func createFriendListQuery(paramsBuilder: (FriendListQueryParams) -> Void) -> FriendListQueryParameters
paramsBuilderThe builder closure for setting
FriendListQueryParams.Return Value
FriendListQueryinstance -
Creates
FriendListQueryinstance for friend listSince
4.0.0Declaration
Swift
public static func createFriendListQuery(params: FriendListQueryParams) -> FriendListQueryParameters
paramsThe params object to change query condition.
Return Value
FriendListQueryinstance -
Sets current user to be discoverable by others
Since
3.0.205Declaration
Swift
public static func setAllowFriendDiscovery( _ allow: Bool, completionHandler: SBErrorHandler? = nil )Parameters
allowif
true, current user will be set to discoverable by others -
Gets a flag whether current user is discoverable or not by others
Since
3.0.205Declaration
Swift
public static func getAllowFriendDiscovery( completionHandler: ((_ allowFriendDiscovery: Bool, _ error: SBError?) -> Void)? = nil ) -
Deletes a given user ID from friend list
Declaration
Swift
public static func deleteFriend( userId: String, completionHandler: SBErrorHandler? = nil )Parameters
userIduser ID
completionHandlercompletion handler
-
Deletes a given list of user from friend list
Declaration
Swift
public static func deleteFriends( userIds: [String], completionHandler: SBErrorHandler? = nil )Parameters
userIdsuser ID list
completionHandlercompletion handler
-
Deletes a friend with given discovery key
Declaration
Swift
public static func deleteFriend( discoveryKey: String, completionHandler: SBErrorHandler? = nil )Parameters
discoveryKeydiscovery key that associates with friend
completionHandlercompletion handler
-
Deletes list of friends with given discovery keys
Declaration
Swift
public static func deleteFriends( discoveryKeys: [String], completionHandler: SBErrorHandler? = nil )Parameters
discoveryKeyslist of discovery key that associates with friends
completionHandlercompletion handler
-
Uploads discovery key and corresponding name
Declaration
Swift
public static func uploadFriendDiscoveries( _ discoveryKeyAndNames: [String: String], completionHandler: SBErrorHandler? = nil )Parameters
discoveryKeyAndNamesa dictionary contains discovery key as key and name as value
completionHandlercompletion handler
-
Fetches friends’ change log
Declaration
Parameters
tokena string to pagniate next page
completionHandlercompletion handler
-
Gets the number of group channel with the filter.
Since
3.0.116Declaration
Swift
public static func getGroupChannelCount( myMemberStateFilter: MyMemberStateFilter, completionHandler: @escaping CountHandler )Parameters
myMemberStateFilterThe member state of the current user in the channels that are counted.
completionHandlerThe handler block to execute.
-
Gets the total unread channel count of all group channels.
Since
3.0.116Declaration
Swift
public static func getTotalUnreadChannelCount( completionHandler: @escaping CountHandler )Parameters
completionHandlerThe handler block to execute. The
unreadCountis the total count of unread channels in all of group channel which the current is a member. -
Gets the total unread channel count of all group channels with filters of params.
Since
3.1.7Declaration
Swift
public static func getTotalUnreadChannelCount( params: GroupChannelTotalUnreadChannelCountParams, completionHandler: @escaping CountHandler )Parameters
paramsThe instance of parameters to filter.
completionHandlerThe handler block to execute. The
unreadCountis the total count of unread group channels of which the current user is a member, filtered byparams. -
Gets the number of unread messages in group channels.
Since
3.0.116Declaration
Swift
public static func getTotalUnreadMessageCount( completionHandler: @escaping CountHandler )Parameters
completionHandlerThe handler block to execute. The
unreadCountis the total count of unread messages in all of group channel which the current is a member. -
Gets the number of unread notifications in feed channels.
Since
4.19.8Declaration
Swift
public class func getTotalUnreadNotificationsCount( completionHandler: @escaping CountHandler )Parameters
completionHandlerThe handler block to execute. The
unreadCountis the total count of unread notifications in all of feed channel which the current is a member of.. -
Gets the total unread message count of the channels with filters of params.
Since
3.0.116Declaration
Swift
@available(*, deprecated, renamed: "getTotalUnreadMessageCountWithFeed(params:completionHandler:﹚", message: "This method is deprecated in 4.6.0.") public static func getTotalUnreadMessageCount( params: GroupChannelTotalUnreadMessageCountParams, completionHandler: @escaping CountHandler )Parameters
paramsThe instance of parameters to filter.
completionHandlerThe 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.
-
Gets the total unread message count of the channels with filters of params.
Since
4.6.0Declaration
Swift
public static func getTotalUnreadMessageCountWithFeed( params: GroupChannelTotalUnreadMessageCountParams, completionHandler: @escaping UnreadMessageCountHandler )Parameters
paramsThe instance of parameters to filter.
completionHandlerThe 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.
-
Gets unread messages and mentions counts of message and invitation counts in super and non_super channels.
Since
3.0.116
Declaration
Swift
@available(*, deprecated, renamed: "getUnreadItemCount(params:completionHandler:﹚", message: "This method is deprecated in 4.21.0. Set `key` in `GroupChannelUnreadItemCountParams` and use `getUnreadItemCount(params:completionHandler:﹚` instead.") public static func getUnreadItemCount( key: UnreadItemKey, completionHandler: @escaping (_ count: UnreadItemCount?, _ error: SBError?) -> Void )Parameters
keyUnreadItemKeyoptionSets to contain count flagscompletionHandlerThe 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 UnreadItemCount that contains unsinged interger for count you requested. the other is an error made when there is something wrong to response.
-
Gets unread messages and mentions counts of message and invitation counts in super and non_super channels.
Since
4.21.0
Declaration
Swift
public static func getUnreadItemCount( params: GroupChannelUnreadItemCountParams, completionHandler: @escaping (_ count: UnreadItemCount?, _ error: SBError?) -> Void )Parameters
paramscompletionHandlerThe 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
UnreadItemCountthat contains unsinged interger for count you requested. The other is an error made when there is something wrong to response. -
Gets total unread message count for current user
Declaration
Swift
public static func getSubscribedTotalUnreadMessageCount() -> Int -
Gets total unread message count that is subscribed with custom types for current user
Declaration
Swift
public static func getSubscribedCustomTypeTotalUnreadMessageCount() -> Int -
Gets unread message count on channels with given custom type for current user
Declaration
Swift
public static func getSubscribedCustomTypeUnreadMessageCount( customType: String ) -> Int
-
Marks as read all group channels of the current user.
Declaration
Swift
public static func markAsReadAll(completionHandler: SBErrorHandler? = nil)Parameters
completionHandlerThe handler block to execute.
-
Marks as read some group channels of the current user.
Declaration
Swift
public static func markAsRead( channelURLs: [String], completionHandler: SBErrorHandler? = nil )Parameters
channelURLsThe array list with channel urls to be marked as read.
completionHandlerThe handler block to execute.
-
Marks as delivered with the payload of the remote notification.
Since
3.0.183Declaration
Swift
public static func markAsDelivered( remoteNotificationPayload: [AnyHashable: Any], completionHandler: SBErrorHandler? = nil )Parameters
remoteNotificationPayloadThe remote notification payload
completionHandlerThe handler block to execute
-
Marks push notification as delivered for push delivery tracking purpose only. It is only work for
Notification Service Extension. This does not mark the message as delivered.Since
4.10.0Declaration
Swift
public static func markPushNotificationAsDelivered( remoteNotificationPayload: [AnyHashable: Any], completionHandler: SBErrorHandler? = nil )Parameters
remoteNotificationPayloadThe remote notification payload
completionHandlerThe handler block to execute
-
Marks push notification as delivered for push delivery tracking purpose only. It is only work for
Notification Service Extension. This does not mark the message as delivered.Since
4.19.8Declaration
Swift
public class func markPushNotificationAsDelivered( apiHost: String? = nil, remoteNotificationPayload: [AnyHashable: Any], completionHandler: SBErrorHandler? = nil )Parameters
apiHostThe API host. If nil, the default host is used.
remoteNotificationPayloadThe remote notification payload
completionHandlerThe handler block to execute
-
Marks push notification as clicked for push tracking purpose only. This does not mark the message as delivered.
Since
4.18.0Declaration
Swift
public static func markPushNotificationAsClicked( remoteNotificationPayload: [AnyHashable: Any], completionHandler: SBErrorHandler? = nil )Parameters
remoteNotificationPayloadThe remote notification payload
completionHandlerThe handler block to execute
-
Marks push notification as clicked for push tracking purpose only. This does not mark the message as delivered.
Since
4.19.8Declaration
Swift
public class func markPushNotificationAsClicked( apiHost: String? = nil, remoteNotificationPayload: [AnyHashable: Any], completionHandler: SBErrorHandler? = nil )Parameters
apiHostThe API host. If nil, the default host is used.
remoteNotificationPayloadThe remote notification payload
completionHandlerThe handler block to execute
-
Requests updated channels and deleted channel URLs since a certain time. A certain time is decided by a token.
Since
3.0.182Declaration
Swift
public static func getMyGroupChannelChangeLogs( token: String?, params: GroupChannelChangeLogsParams = GroupChannelChangeLogsParams(), completionHandler: @escaping ChannelChangeLogsHandler )Parameters
tokenThe token used to get next pagination of changelogs.
paramsthe parameter object that filters a result. See
GroupChannelChangeLogsParamsfor more detailcompletionHandlerThe handler type of
ChannelChangeLogsHandlerblock to execute. TheupdatedChannelsis the channels that were updated. ThedeletedChannelURLsis the list of the deleted channel URLs. If there are more changelogs that are not returned yet, thehasMoreistrue. Thetokencan be used to get more changedlogs. -
Requests updated channels and deleted channel URLs since the timestamp.
Since
3.0.182Declaration
Swift
public static func getMyGroupChannelChangeLogs( timestamp: Int64, params: GroupChannelChangeLogsParams = GroupChannelChangeLogsParams(), completionHandler: @escaping ChannelChangeLogsHandler )Parameters
timestampThe number of milli-seconds(msec). Requests changelogs from that time. This value must not be negative.
paramsthe parameter object that filters a result. See
GroupChannelChangeLogsParamsfor more detailcompletionHandlerThe handler type of
ChannelChangeLogsHandlerblock to execute. TheupdatedChannelsis the channels that were updated. ThedeletedChannelURLsis the list of the deleted channel URLs. If there are more changelogs that are not returned yet, thehasMoreistrue. Thetokencan be used to get more changedlogs. -
Fetches updated user list since a certain time. A certain time is decided by a token.
Since
4.11.1Declaration
Swift
public static func getMembersChangeLogs( token: String, completionHandler: @escaping MembersChangeLogsHandler )Parameters
tokenThe token used to get next pagination of changelogs.
completionHandlerThe handler type of
MembersChangeLogsHandlerblock to execute. -
Fetches updated user list since the timestamp.
Since
4.11.1Declaration
Swift
public static func getMembersChangeLogs( timestamp: Int64, completionHandler: @escaping MembersChangeLogsHandler )Parameters
timestampThe number of milli-seconds(msec). Requests changelogs from that time. This value must not be negative.
completionHandlerThe handler type of
MembersChangeLogsHandlerblock to execute.
-
Retrieves the log level.
Declaration
Swift
public static func getLogLevel() -> LogLevelReturn Value
Log level.
-
Gets mime type of file.
Declaration
Swift
public static func getMimeType(_ file: Data?) -> String?Parameters
fileFile to get mime type.
Return Value
Returns mime type of the file.
-
Turns on or off the reconnection by network awareness.
Declaration
Swift
public static func setNetworkAwarenessReconnection(_ isOn: Bool)Parameters
isOnIf
true, the reconnection by network Awareness is turned. -
Sendbird user agent information getter.
Declaration
Swift
public static func getSBUserAgent() -> String -
Initialize
sharedContainerIdentifierof NSURLSessionConfiguration to use background session.Important
If you use
App Extensionand use upload file message in extension, you MUST set thie field.Declaration
Swift
public static func setSharedContainerIdentifier(_ identifier: String)Parameters
identifierThe identifier to set background session configuraion.
-
Sets dispatch queue for every completion handler and delegate. Default queue is the main queue.
Important
This function must be used after the initialize function of SendbirdChat.
Declaration
Swift
public static func setCompletionHandlerDelegateQueue(_ queue: DispatchQueue)Parameters
queueDispatch queue for every completion handler and delegate.
-
Runs block in the dispatch queue that was set by
setCompletionHandlerDelegateQueue(_:).Declaration
Swift
public static func performCompletionHandlerDelegateQueue(_ block: (() -> Void)? = nil)Parameters
blockBlock to run.
-
Sets the app group.
Since
3.0.183Declaration
Swift
public static func setAppGroup(_ appGroup: String)Parameters
appGroupThe app group.
-
Gets the key to authenticate the file URL.
This has to be put into the HTTP header when the client needs to access it.
Since
3.0.194Declaration
Swift
public static func ekey() -> String?Return Value
The key to authenticate the file URL
-
Requests a emoji container which contains hash and list of emoji category.
Since
3.0.180Declaration
Swift
public static func getAllEmojis( _ completionHandler: ((_ emojiContainer: EmojiContainer?, _ error: SBError?) -> Void)? = nil )Parameters
completionHandlerThe handler block to execute after request is completed
-
Requests updated channels and deleted channel URLs since the timestamp.
Since
3.0.180Declaration
Parameters
emojiKeyThe emoji key
completionHandlerThe handler block to execute after request is completed
-
Requests updated channels and deleted channel URLs since the timestamp.
Since
3.0.180Declaration
Swift
public static func getEmojiCategory( _ categoryId: Int64, completionHandler: ((_ emojiCategory: EmojiCategory?, _ error: SBError?) -> Void)? = nil )Parameters
categoryIdThe category ID
completionHandlerThe handler block to execute after request is completed
-
Gets the current user object.
The object is valid when the connection succeeded.
Declaration
Swift
public static func getCurrentUser() -> User?Return Value
The current user object.
-
Gets the current user’s latest connection millisecond time(UTC).
If the connection state is not public, Returns 0.
Since
3.0.117Declaration
Swift
public static func getLastConnectedAt() -> Int64Return Value
latest connected millisecond time stamp.
-
Updates the current user’s information
Since
4.0.0Declaration
Swift
public static func updateCurrentUserInfo( params: UserUpdateParams, progressHandler: ProgressHandler? = nil, completionHandler: SBErrorHandler? = nil )Parameters
paramsUserUpdateParamsinstanceprogressHandlerThe handler block to monitor progression.
bytesSentis the number of bytes sent ///since the last time this method was called.totalBytesSentis the total number of bytes sent so far. ///totalBytesExpectedToSendis the expected length of the body data. -
Updates the current user’s preferred languages
Declaration
Swift
public static func updateCurrentUserInfo( preferredLanguages: [String], completionHandler: SBErrorHandler? = nil )Parameters
preferredLanguagesNew array of preferred languages
completionHandlerThe handler block to execute.
-
Blocks the specified user.
Declaration
Swift
public static func blockUserId( _ userId: String, completionHandler: UserHandler? = nil )Parameters
userIdThe user ID to be blocked.
completionHandlerThe handler block to execute.
blockedUseris the blocked user by the current user. -
Blocks the specified user.
Declaration
Swift
public static func blockUser( _ user: User, completionHandler: UserHandler? = nil )Parameters
userThe user to be blocked.
completionHandlerThe handler block to execute.
blockedUseris the blocked user by the current user. -
Unblocks the specified user.
Declaration
Swift
public static func unblockUserId( _ userId: String, completionHandler: SBErrorHandler? = nil )Parameters
userIdThe user ID which was blocked.
completionHandlerThe handler block to execute.
-
Unblocks the specified user.
Declaration
Swift
public static func unblockUser( _ user: User, completionHandler: SBErrorHandler? = nil )Parameters
userThe user who was blocked.
completionHandlerThe handler block to execute.
-
Loads the list of
ReportCategoryInfo.Since
4.23.0Declaration
Swift
public static func getReportCategoryInfoList( completionHandler: ReportCategoryInfoListHandler? = nil )Parameters
completionHandlerThe handler with the list of
ReportCategoryInfo. -
Creates a group channel collection
Declaration
Swift
public static func createGroupChannelCollection( query: GroupChannelListQuery ) -> GroupChannelCollection?Parameters
queryGroupChannelListQueryinstanceReturn Value
GroupChannelCollectioninstance -
Creates a message collection
Declaration
Swift
public static func createMessageCollection( channel: GroupChannel, startingPoint: Int64, params: MessageListParams ) -> MessageCollectionParameters
channelGroupChannelinstancestartingPointEpoch timestamp that will be used as pivot point to fetch messages
paramsMessageListParamsinstance -
Since
4.6.0Declaration
Swift
public static func createNotificationCollection( channel: FeedChannel, startingPoint: Int64, params: MessageListParams, delegate: NotificationCollectionDelegate? ) -> NotificationCollection? -
Clears local cached data
Declaration
Swift
public static func clearCachedData(completionHandler: SBErrorHandler?)Parameters
completionHandlercompletion
-
Clears local cached message
Declaration
Swift
public static func clearCachedMessages(channelURL: String, completionHandler: SBErrorHandler?)Parameters
channelURLchannel URL
completionHandlercompletion
-
Returns local cached data size in byte
Declaration
Swift
public static func getCachedDataSize() -> IntReturn Value
cached data size
-
Checks if local caching is enabled.
Since
3.1.0Declaration
Swift
public static var isLocalCachingEnabled: Bool -
Gets the number of scheduled messages.
Since
4.0.0Declaration
Swift
public static func getTotalScheduledMessageCount( params: TotalScheduledMessageCountParams, completionHandler: @escaping CountHandler )Parameters
paramsThe object that contains a set of options to get scheduled messages.
completionHandlerThe handler block to be executed after the total scheduled message count in the channel is fetched or an error occurs.
-
Creates
ScheduledMessageListQueryfor getting the list of scheduled messages.Since
4.0.0Declaration
Swift
public static func createScheduledMessageListQuery( channelURL: String? ) -> ScheduledMessageListQueryParameters
channelURLThe channel URL. If
channelURLis nil, you will get scheduled messages for all channels.Return Value
The scheduled message list query object.
-
Creates
ScheduledMessageListQueryfor getting the list of scheduled messages.Since
4.0.0Declaration
Swift
public static func createScheduledMessageListQuery( channelURL: String?, paramsBuilder: (ScheduledMessageListQueryParams) -> Void ) -> ScheduledMessageListQueryParameters
channelURLThe channel URL. If
channelURLis nil, you will get scheduled messages for all channels.paramsBuilderThe builder closure for setting
ScheduledMessageListQueryParams.Return Value
The scheduled message list query object.
-
Creates
ScheduledMessageListQueryfor getting the list of scheduled messages.Since
4.0.0Declaration
Swift
public static func createScheduledMessageListQuery( channelURL: String?, params: ScheduledMessageListQueryParams ) -> ScheduledMessageListQueryParameters
channelURLThe channel URL. If
channelURLis nil, you will get scheduled messages for all channels.paramsThe params object to change query condition.
Return Value
The scheduled message list query object.
-
Creates
PollListQuerySince
4.1.0Declaration
Swift
public static func createPollListQuery(params: PollListQueryParams) -> PollListQueryParameters
paramsThe params object to change query condition.
Return Value
PollListQueryinstance -
Creates
PollListQuerySince
4.1.0Declaration
Swift
public static func createPollListQuery(paramsBuilder: (PollListQueryParams) -> Void) -> PollListQueryParameters
paramsBuilderThe builder closure for setting
PollListQueryParams.Return Value
PollListQueryinstance. -
Creates
PollVoterListQuerySince
4.1.0Declaration
Swift
public static func createPollVoterListQuery(params: PollVoterListQueryParams) -> PollVoterListQueryParameters
paramsThe params object to change query condition.
Return Value
PollVoterListQueryinstance. -
Creates
PollVoterListQuerywith paramsBuilder.Declaration
Swift
public static func createPollVoterListQuery(paramsBuilder: (PollVoterListQueryParams) -> Void) -> PollVoterListQueryParameters
paramsBuilderThe builder closure for setting
GroupChannelListQueryParams.Return Value
GroupChannelListQuery instance for the current user.
-
Requests updated feed channels and deleted feed channel URLs since a certain time. A certain time is decided by a timestamp.
Since
4.6.0Declaration
Swift
public static func getMyFeedChannelChangeLogs( timestamp: Int64, params: FeedChannelChangeLogsParams = FeedChannelChangeLogsParams(), completionHandler: @escaping FeedChannelChangeLogsHandler )Parameters
timestampThe number of milli-seconds(msec). Requests changelogs from that time. This value must not be negative.
paramsthe parameter object that filters a result. See
FeedChannelChangeLogsParamsfor more detailcompletionHandlerThe handler type of
FeedChannelChangeLogsHandlerblock to execute. TheupdatedChannelsis the channels that were updated. ThedeletedChannelURLsis the list of the deleted channel URLs. If there are more changelogs that are not returned yet, thehasMoreistrue. Thetokencan be used to get more changedlogs. -
Requests updated feed channels and deleted feed channel URLs since a certain time. A certain time is decided by a token.
Since
4.6.0Declaration
Swift
public static func getMyFeedChannelChangeLogsByToken( token: String?, params: FeedChannelChangeLogsParams = FeedChannelChangeLogsParams(), completionHandler: @escaping FeedChannelChangeLogsHandler )Parameters
tokenThe token used to get next pagination of changelogs.
paramsthe parameter object that filters a result. See
FeedChannelChangeLogsParamsfor more detailcompletionHandlerThe handler type of
FeedChannelChangeLogsHandlerblock to execute. TheupdatedChannelsis the channels that were updated. ThedeletedChannelURLsis the list of the deleted channel URLs. If there are more changelogs that are not returned yet, thehasMoreistrue. Thetokencan be used to get more changedlogs. -
Since
4.6.0Declaration
Swift
public static func getUnreadMessageCount() -> UnreadMessageCount -
Since
4.6.0Declaration
Swift
public static func getGlobalNotificationChannelSetting( completionHandler: @escaping GlobalNotificationChannelSettingHandler ) -
Since
4.6.0Declaration
Swift
public static func getNotificationTemplateList( token: String?, params: NotificationTemplateListParams = NotificationTemplateListParams(), completionHandler: @escaping NotificationTemplateListHandler ) -
Since
4.6.0Declaration
Swift
public static func getNotificationTemplate( key: String, completionHandler: @escaping NotificationTemplateHandler ) -
Since
4.17.0Declaration
Swift
public static func getMessageTemplateList( token: String?, params: MessageTemplateListParams = MessageTemplateListParams(), completionHandler: @escaping MessageTemplateListHandler ) -
Since
4.17.0Declaration
Swift
public static func getMessageTemplate( key: String, completionHandler: @escaping MessageTemplateHandler ) -
Since
4.8.4Declaration
Swift
public static func __getUIKitConfiguration( completionhandler: @escaping UIKitConfigurationHandler ) -
Refresh the contents of all notification collections that are currently valid. Notification collection must be valid with
isLiveflag beingtrue.Since
4.10.0Declaration
Swift
public static func refreshNotificationCollections() -
Send a user message by specifying a channel type, channel URL, and the parameters to send the user message with the given parameters.
Note
This method just sends the message through API. In most scenarios, you should call
GroupChannel.getChannelorOpenChannel.getChanneland use the retrieved channel objects to send and receive messages. This method is for sending message without getting the channel object when the application execution time is limited, such as in app extensions.Declaration
Swift
public static func sendUserMessage(channelType: ChannelType, channelURL: String, params: UserMessageCreateParams, completionHandler: UserMessageHandler?)Parameters
channelTypeThe channel type of the channel to send the message in.
channelURLThe channel URL of the channel to send the message in.
paramsThe instance of
UserMessageCreateParamsthat can has parameters related with string message.completionHandlerThe handler block to be executed after the message was sent. This block has no return value and takes two argument, one is a file message was sent and other is an error made when there is something wrong to message.
-
Undocumented
See moreDeclaration
Swift
class PushTemplate: NSObject -
Used to set the version information of the Sendbird SDK extension.
Declaration
Swift
public static func __addExtension(_ key: String, version: String)Parameters
keyExtension sdk’s hidden key
versionExtension sdk’s version string
-
Used to set the version information of the Sendbird SDK extension.
Declaration
Swift
@available(*, deprecated, renamed: "__addExtension(_:version:﹚", message: "This method is deprecated in 4.8.3") public static func addExtension(_ key: String, version: String)Parameters
keyExtension sdk’s hidden key
versionExtension sdk’s version string
-
Used to set the version information of the Sendbird SDK extensions in user agent.
Since
4.8.5Declaration
Swift
public static func __addSendbirdExtensions(extensions: [__SendbirdSDKInfo], customData: [String: String]?) -> BoolParameters
extensionsA non-empty array of extension SDKs’ versions.
customDataCustom data in String to add in user agent.
Return Value
false if extensions don’t satisfy Semantic Versioning or custom data includes “&” or “=”.
View on GitHub
Install in Dash