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

    @objc
    public static var isInitialized: Bool { get }

    Return Value

    If true, SendbirdChat instance is initialized.

  • Retrieves the SDK version.

    Declaration

    Swift

    @objc
    public static func getSDKVersion() -> String

    Return Value

    The SDK version.

  • Gets the Application ID which was used for initialization.

    Declaration

    Swift

    @objc
    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.3

    Declaration

    Swift

    @objc
    public static func setAppVersion(version: String?)

    Parameters

    version

    The version of the app.

  • Gets the maximum number of files in a MultipleFilesMessage.

    Since

    4.9.1

    Declaration

    Swift

    @objc
    public static func getMultipleFilesMessageFileCountLimit() -> Int

    Return Value

    multipleFilesMessageFileCountLimit

  • Initializes SendbirdChat 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.

    Since

    3.0.227

    Declaration

    Swift

    @discardableResult
    @objc
    public static func initialize(
        params: InitParams,
        migrationStartHandler: VoidHandler? = nil,
        completionHandler: SBErrorHandler? = nil
    ) -> Bool

    Parameters

    params

    InitParams object

    migrationStartHandler

    handler that notifies when local cache migration has started

    completionHandler

    handler that notifies when local cache is ready to use

    Return Value

    true if the applicationId is set.

  • Synchronously initializes SendbirdChat 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.

    Since

    4.0.15

    Declaration

    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.")
    @discardableResult
    @objc
    public static func initializeSynchronously(params: InitParams) -> SBError?

    Parameters

    params

    InitParams object

    Return Value

    nil if the applicationId is set, otherwise SBError

  • 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 .completed state, the executeHandler is called immediately. If the component is not yet initialized, the function waits until the initialization state changes to .completed before calling the executeHandler.

    Important

    This function MUST be set after SendbirdChat.initialize to work.

    Usage Example:

    executeOrWaitForInitialization {
        // Code to run when already initialized or to run after initialization
    }
    

    Since

    4.15.0

    Declaration

    Swift

    public static func executeOrWaitForInitialization(executeHandler: @escaping () -> Void)

    Parameters

    executeHandler

    A 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

    @objc
    public static func connect(
        userId: String,
        completionHandler: UserHandler? = nil
    )

    Parameters

    userId

    The user ID.

    completionHandler

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

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

    Declaration

    Swift

    @objc
    public static func connect(
        userId: String,
        authToken: String?,
        completionHandler: UserHandler? = nil
    )

    Parameters

    userId

    The user ID.

    authToken

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

    completionHandler

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

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

    Warning

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

    Declaration

    Swift

    @objc
    public static func connect(
        userId: String,
        authToken: String?,
        apiHost: String?,
        wsHost: String?,
        completionHandler: UserHandler? = nil
    )

    Parameters

    userId

    user ID

    authToken

    authToken

    apiHost

    apiHost

    wsHost

    wsHost

    completionHandler

    completionHandler

  • 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 calling SendbirdChat.disconnect.

    Note

    Use the disconnect(completionHandler:) method to deauthenticate.

    Since

    4.10.0

    Declaration

    Swift

    @available(*, deprecated, renamed: "authenticate")
    @objc
    public static func authenticateFeed(
        userId: String,
        authToken: String?,
        completionHandler: UserHandler? = nil
    )

    Parameters

    userId

    The user ID.

    authToken

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

    completionHandler

    The handler block to execute. user is 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 calling SendbirdChat.disconnect.

    Note

    Use the disconnect(completionHandler:) method to deauthenticate.

    Since

    4.10.0

    Declaration

    Swift

    @available(*, deprecated, renamed: "authenticate")
    @objc
    public static func authenticateFeed(
        userId: String,
        authToken: String?,
        apiHost: String?,
        completionHandler: UserHandler? = nil
    )

    Parameters

    userId

    The user ID.

    authToken

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

    apiHost

    apiHost

    completionHandler

    The handler block to execute. user is 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 calling SendbirdChat.disconnect.

    Note

    Use the disconnect(completionHandler:) method to deauthenticate.

    Since

    4.19.8

    Declaration

    Swift

    @objc
    public class func authenticate(
        userId: String,
        authToken: String?,
        apiHost: String? = nil,
        completionHandler: UserHandler? = nil
    )

    Parameters

    userId

    The user ID.

    authToken

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

    apiHost

    apiHost

    completionHandler

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

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

    Declaration

    Swift

    @objc
    public static func disconnect(completionHandler: VoidHandler? = nil)

    Parameters

    completionHandler

    The handler block to execute.

  • Disconnects WebSocket only.

    Since

    4.4.0

    Declaration

    Swift

    @objc
    public static func disconnectWebSocket(completionHandler: VoidHandler? = nil)

    Parameters

    completionHandler

    The handler block to execute.

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

    Declaration

    Swift

    @discardableResult
    @objc
    public static func reconnect() -> Bool

    Return Value

    true if there is the data to be used for reconnection.

  • The completion handler of background session.

    Declaration

    Swift

    @objc
    public static var backgroundSessionCompletionHandler: VoidHandler? { get set }
  • Gets information set in the Application.

    Since

    3.0.180

    Declaration

    Swift

    @objc
    public static func getAppInfo() -> AppInfo?
  • Gets the WebSocket server connection state.

    Declaration

    Swift

    @objc
    public static func getConnectState() -> WebSocketConnectionState

    Return Value

    WebSocketConnectionState indicating socket connection state

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

    Since

    3.0.120

    Declaration

    Swift

    @objc
    public static func createApplicationUserListQuery() -> ApplicationUserListQuery

    Return Value

    ApplicationUserListQuery instance.

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

    Since

    3.0.120

    Declaration

    Swift

    @objc
    public static func createApplicationUserListQuery(
        paramsBuilder: (ApplicationUserListQueryParams) -> Void
    ) -> ApplicationUserListQuery

    Parameters

    paramsBuilder

    The builder closure for setting ApplicationUserListQueryParams.

    Return Value

    ApplicationUserListQuery instance.

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

    Since

    3.0.120

    Declaration

    Swift

    @objc
    public static func createApplicationUserListQuery(
        params: ApplicationUserListQueryParams
    ) -> ApplicationUserListQuery

    Parameters

    params

    Return Value

    ApplicationUserListQuery instance.

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

    Declaration

    Swift

    @objc
    public static func createBlockedUserListQuery() -> BlockedUserListQuery

    Return Value

    BlockedUserListQuery instance.

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

    Declaration

    Swift

    @objc
    public static func createBlockedUserListQuery(
        paramsBuilder: (BlockedUserListQueryParams) -> Void
    ) -> BlockedUserListQuery

    Parameters

    paramsBuilder

    The builder closure for setting BlockedUserListQueryParams.

    Return Value

    BlockedUserListQuery instance.

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

    Declaration

    Swift

    @objc
    public static func createBlockedUserListQuery(params: BlockedUserListQueryParams) -> BlockedUserListQuery

    Parameters

    params

    Return Value

    BlockedUserListQuery instance.

  • Creates MessageSearchQuery instance for message search

    Since

    4.0.0

    Declaration

    Swift

    @objc
    public static func createMessageSearchQuery(builder: (MessageSearchQueryParams) -> Void) -> MessageSearchQuery

    Parameters

    builder

    The builder closure for setting MessageSearchQueryParams

    Return Value

    MessageSearchQuery instance

  • Creates MessageSearchQuery instance for message search

    Since

    4.0.0

    Declaration

    Swift

    @objc
    public static func createMessageSearchQuery(params: MessageSearchQueryParams) -> MessageSearchQuery

    Parameters

    params

    The params object to change query condition.

    Return Value

    MessageSearchQuery instance

Delegates

Push

  • Gets the pending push token.

    Declaration

    Swift

    @objc
    public static func getPendingPushToken() -> Data?

    Return Value

    Returns the pending push token.

  • Registers the current device token to Sendbird.

    Declaration

    Swift

    @objc
    public static func registerDevicePushToken(
        _ devToken: Data,
        unique: Bool,
        completionHandler: ((_ registrationStatus: PushTokenRegistrationStatus, _ error: SBError?) -> Void)? = nil
    )

    Parameters

    devToken

    Device token for APNS.

    unique

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

    completionHandler

    The handler block to execute. status is the status for push token registration. It is defined in PushTokenRegistrationStatus. .success represents the devToken is registered. .pending 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. .error represents 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?﹚`")
    @objc
    public static func unregisterPushToken(
        _ devToken: Data,
        completionHandler: ((_ response: [AnyHashable: Any]?, _ error: SBError?) -> Void)? = nil
    )

    Parameters

    devToken

    Device token for APNS.

    completionHandler

    The handler block to execute.

  • Unregisters the current device token from Sendbird.

    Declaration

    Swift

    @objc(unregisterPushToken:completion:)
    public static func unregisterPushToken(
        _ pushToken: Data,
        completionHandler: SBErrorHandler? = nil
    )

    Parameters

    pushToken

    Device token for APNS.

    completionHandler

    The 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?﹚`")
    @objc
    public static func unregisterAllPushToken(
        completionHandler: ((_ response: [AnyHashable: Any]?, _ error: SBError?) -> Void)? = nil
    )

    Parameters

    completionHandler

    The handler block to execute.

  • Unregisters all device tokens for the current user from Sendbird.

    Declaration

    Swift

    @objc(unregisterAllPushTokenWithCompletion:)
    public static func unregisterAllPushToken(
        completionHandler: SBErrorHandler? = nil
    )

    Parameters

    completionHandler

    The handler block to execute.

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

    Since

    3.0.134

    Declaration

    Swift

    @objc(getMyPushTokensWithToken:pushTokenType:completionHandler:)
    public static func getMyPushTokens(
        token: String?,
        pushTokenType: PushTokenType,
        completionHandler: @escaping GetPushTokensHandler
    )

    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.

Preference

  • 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

    @objc
    public static func setDoNotDisturb(
        enable: Bool,
        startHour: Int32,
        startMin: Int32,
        endHour: Int32,
        endMin: Int32,
        timezone: String,
        completionHandler: SBErrorHandler? = nil
    )

    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.

  • Gets Do-not-disturb.

    Declaration

    Swift

    @objc
    public static func getDoNotDisturb(
        completionHandler: ((_ enabled: Bool,
                             _ startHour: Int,
                             _ startMin: Int,
                             _ endHour: Int,
                             _ endMin: Int,
                             _ timezone: String,
                             _ error: SBError?) -> Void)? = nil
    )

    Parameters

    completionHandler

    The 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, use SendbirdChat setDoNotDisturb(enable:startHour:startMin:endHour:endMin:timezone:completionHandler:).

    Since

    3.0.128

    Declaration

    Swift

    @objc
    public static func setSnoozePeriod(
        enabled: Bool,
        startTimestamp: Int64,
        endTimestamp: Int64,
        completionHandler: SBErrorHandler? = nil
    )

    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.

  • Requests whether the current user snooze remote push notification.

    Since

    3.0.128

    Declaration

    Swift

    @objc
    public static func getSnoozePeriod(
        _ completionHandler: @escaping SnoozePeriodHandler
    )

    Parameters

    completionHandler

    The 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.128

    Declaration

    Swift

    @objc
    public static func setPushTriggerOption(
        _ pushTriggerOption: PushTriggerOption,
        completionHandler: SBErrorHandler? = nil
    )

    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.

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

    Since

    3.0.128

    Declaration

    Swift

    @objc
    public static func getPushTriggerOption(
        completionHandler: @escaping PushTriggerOptionHandler
    )

    Parameters

    completionHandler

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

  • Sets push sound

    Declaration

    Swift

    @objc
    public static func setPushSound(
        _ sound: String,
        completionHandler: SBErrorHandler? = nil
    )

    Parameters

    sound

    Push sound

    completionHandler

    The handler block to be executed after set push sound.

  • Gets push shound

    Declaration

    Swift

    @objc
    public static func getPushSound(
        completionHandler: ((_ pushSound: String?, _ error: SBError?) -> Void)? = nil
    )

    Parameters

    completionHandler

    The handler block to execute.

  • Sets a push template of the current user.

    Declaration

    Swift

    @objc
    public static func setPushTemplate(
        name: String,
        completionHandler: SBErrorHandler? = nil
    )

    Parameters

    name

    The name of push template. Uses SendbirdChat.PushTemplate constants

    completionHandler

    The handler block to execute.

  • Gets a push template of the current user.

    Declaration

    Swift

    @objc
    public static func getPushTemplate(
        completionHandler: ((_ pushTemplate: String?, _ error: SBError?) -> Void)? = nil
    )

    Parameters

    completionHandler

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

  • Sets group channel invitation preference for auto acceptance.

    Declaration

    Swift

    @objc
    public static func setChannelInvitationPreference(
        autoAccept: Bool,
        completionHandler: SBErrorHandler? = nil
    )

    Parameters

    autoAccept

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

    completionHandler

    The handler block to execute.

  • Gets group channel inviation preference for auto acceptance.

    Declaration

    Swift

    @objc
    public static func getChannelInvitationPreferenceAutoAccept(
        completionHandler: ((_ autoAccept: Bool, _ error: SBError?) -> Void)? = nil
    )

    Parameters

    completionHandler

    The handler block to execute.

Friend

Info

  • Gets the number of group channel with the filter.

    Since

    3.0.116

    Declaration

    Swift

    @objc(getGroupChannelCountWithMyMemberStateFilter:completionHandler:)
    public static func getGroupChannelCount(
        myMemberStateFilter: MyMemberStateFilter,
        completionHandler: @escaping CountHandler
    )

    Parameters

    myMemberStateFilter

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

    completionHandler

    The handler block to execute.

  • Gets the total unread channel count of all group channels.

    Since

    3.0.116

    Declaration

    Swift

    @objc
    public static func getTotalUnreadChannelCount(
        completionHandler: @escaping CountHandler
    )

    Parameters

    completionHandler

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

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

    Since

    3.1.7

    Declaration

    Swift

    @objc
    public static func getTotalUnreadChannelCount(
        params: GroupChannelTotalUnreadChannelCountParams,
        completionHandler: @escaping CountHandler
    )

    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.

  • Gets the number of unread messages in group channels.

    Since

    3.0.116

    Declaration

    Swift

    @objc
    public static func getTotalUnreadMessageCount(
        completionHandler: @escaping CountHandler
    )

    Parameters

    completionHandler

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

  • Gets the number of unread notifications in feed channels.

    Since

    4.19.8

    Declaration

    Swift

    @objc
    public class func getTotalUnreadNotificationsCount(
        completionHandler: @escaping CountHandler
    )

    Parameters

    completionHandler

    The handler block to execute. The unreadCount is 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.116

    Declaration

    Swift

    @available(*, deprecated, renamed: "getTotalUnreadMessageCountWithFeed(params:completionHandler:﹚", message: "This method is deprecated in 4.6.0.")
    @objc
    public static func getTotalUnreadMessageCount(
        params: GroupChannelTotalUnreadMessageCountParams,
        completionHandler: @escaping CountHandler
    )

    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.

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

    Since

    4.6.0

    Declaration

    Swift

    @objc
    public static func getTotalUnreadMessageCountWithFeed(
        params: GroupChannelTotalUnreadMessageCountParams,
        completionHandler: @escaping UnreadMessageCountHandler
    )

    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.

  • 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.")
    @objc
    public static func getUnreadItemCount(
        key: UnreadItemKey,
        completionHandler: @escaping (_ count: UnreadItemCount?, _ error: SBError?) -> Void
    )

    Parameters

    key

    UnreadItemKey optionSets to contain count flags

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

    @objc
    public static func getUnreadItemCount(
        params: GroupChannelUnreadItemCountParams,
        completionHandler: @escaping (_ count: UnreadItemCount?, _ error: SBError?) -> Void
    )

    Parameters

    params
    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 UnreadItemCount that 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

    @objc
    public static func getSubscribedTotalUnreadMessageCount() -> Int
  • Gets total unread message count that is subscribed with custom types for current user

    Declaration

    Swift

    @objc
    public static func getSubscribedCustomTypeTotalUnreadMessageCount() -> Int
  • Gets unread message count on channels with given custom type for current user

    Declaration

    Swift

    @objc
    public static func getSubscribedCustomTypeUnreadMessageCount(
        customType: String
    ) -> Int

Channel

  • Marks as read all group channels of the current user.

    Declaration

    Swift

    @objc
    public static func markAsReadAll(completionHandler: SBErrorHandler? = nil)

    Parameters

    completionHandler

    The handler block to execute.

  • Marks as read some group channels of the current user.

    Declaration

    Swift

    @objc
    public static func markAsRead(
        channelURLs: [String],
        completionHandler: SBErrorHandler? = nil
    )

    Parameters

    channelURLs

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

    completionHandler

    The handler block to execute.

  • Marks as delivered with the payload of the remote notification.

    Since

    3.0.183

    Declaration

    Swift

    @objc
    public static func markAsDelivered(
        remoteNotificationPayload: [AnyHashable: Any],
        completionHandler: SBErrorHandler? = nil
    )

    Parameters

    remoteNotificationPayload

    The remote notification payload

    completionHandler

    The 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.0

    Declaration

    Swift

    @objc
    public static func markPushNotificationAsDelivered(
        remoteNotificationPayload: [AnyHashable: Any],
        completionHandler: SBErrorHandler? = nil
    )

    Parameters

    remoteNotificationPayload

    The remote notification payload

    completionHandler

    The 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.8

    Declaration

    Swift

    @objc
    public class func markPushNotificationAsDelivered(
        apiHost: String? = nil,
        remoteNotificationPayload: [AnyHashable: Any],
        completionHandler: SBErrorHandler? = nil
    )

    Parameters

    apiHost

    The API host. If nil, the default host is used.

    remoteNotificationPayload

    The remote notification payload

    completionHandler

    The 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.0

    Declaration

    Swift

    @objc
    public static func markPushNotificationAsClicked(
        remoteNotificationPayload: [AnyHashable: Any],
        completionHandler: SBErrorHandler? = nil
    )

    Parameters

    remoteNotificationPayload

    The remote notification payload

    completionHandler

    The 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.8

    Declaration

    Swift

    @objc
    public class func markPushNotificationAsClicked(
        apiHost: String? = nil,
        remoteNotificationPayload: [AnyHashable: Any],
        completionHandler: SBErrorHandler? = nil
    )

    Parameters

    apiHost

    The API host. If nil, the default host is used.

    remoteNotificationPayload

    The remote notification payload

    completionHandler

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

    Declaration

    Swift

    @objc(getMyGroupChannelChangeLogsWithToken:params:completionHandler:)
    public static func getMyGroupChannelChangeLogs(
        token: String?,
        params: GroupChannelChangeLogsParams = GroupChannelChangeLogsParams(),
        completionHandler: @escaping ChannelChangeLogsHandler
    )

    Parameters

    token

    The token used to get next pagination of changelogs.

    params

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

    completionHandler

    The handler type of ChannelChangeLogsHandler 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 true. The token can be used to get more changedlogs.

  • Requests updated channels and deleted channel URLs since the timestamp.

    Since

    3.0.182

    Declaration

    Swift

    @objc(getMyGroupChannelChangeLogsWithTimestamp:params:completionHandler:)
    public static func getMyGroupChannelChangeLogs(
        timestamp: Int64,
        params: GroupChannelChangeLogsParams = GroupChannelChangeLogsParams(),
        completionHandler: @escaping ChannelChangeLogsHandler
    )

    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 GroupChannelChangeLogsParams for more detail

    completionHandler

    The handler type of ChannelChangeLogsHandler 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 true. The token can 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.1

    Declaration

    Swift

    @objc(getMembersChangeLogsWithToken:completionHandler:)
    public static func getMembersChangeLogs(
        token: String,
        completionHandler: @escaping MembersChangeLogsHandler
    )

    Parameters

    token

    The token used to get next pagination of changelogs.

    completionHandler

    The handler type of MembersChangeLogsHandler block to execute.

  • Fetches updated user list since the timestamp.

    Since

    4.11.1

    Declaration

    Swift

    @objc(getMembersChangeLogsWithTimestamp:completionHandler:)
    public static func getMembersChangeLogs(
        timestamp: Int64,
        completionHandler: @escaping MembersChangeLogsHandler
    )

    Parameters

    timestamp

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

    completionHandler

    The handler type of MembersChangeLogsHandler block to execute.

Configuration

  • Retrieves the log level.

    Declaration

    Swift

    @objc
    public static func getLogLevel() -> LogLevel

    Return Value

    Log level.

  • Sets the log level. The log level is defined by LogLevel.

    Declaration

    Swift

    @objc
    public static func setLogLevel(_ logLevel: LogLevel)

    Parameters

    logLevel

    Log level.

  • Gets mime type of file.

    Declaration

    Swift

    @objc
    public static func getMimeType(_ file: Data?) -> String?

    Parameters

    file

    File to get mime type.

    Return Value

    Returns mime type of the file.

  • Turns on or off the reconnection by network awareness.

    Declaration

    Swift

    @objc
    public static func setNetworkAwarenessReconnection(_ isOn: Bool)

    Parameters

    isOn

    If true, the reconnection by network Awareness is turned.

  • Sendbird user agent information getter.

    Declaration

    Swift

    @objc
    public static func getSBUserAgent() -> String
  • 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.

    Declaration

    Swift

    @objc
    public static func setSharedContainerIdentifier(_ identifier: String)

    Parameters

    identifier

    The 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

    @objc
    public static func setCompletionHandlerDelegateQueue(_ queue: DispatchQueue)

    Parameters

    queue

    Dispatch queue for every completion handler and delegate.

  • Runs block in the dispatch queue that was set by setCompletionHandlerDelegateQueue(_:).

    Declaration

    Swift

    @objc
    public static func performCompletionHandlerDelegateQueue(_ block: (() -> Void)? = nil)

    Parameters

    block

    Block to run.

  • Sets the app group.

    Since

    3.0.183

    Declaration

    Swift

    @objc
    public static func setAppGroup(_ appGroup: String)

    Parameters

    appGroup

    The 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.194

    Declaration

    Swift

    @objc
    public static func ekey() -> String?

    Return Value

    The key to authenticate the file URL

Emoji

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

    Since

    3.0.180

    Declaration

    Swift

    @objc
    public static func getAllEmojis(
        _ completionHandler: ((_ emojiContainer: EmojiContainer?, _ error: SBError?) -> Void)? = nil
    )

    Parameters

    completionHandler

    The handler block to execute after request is completed

  • Requests updated channels and deleted channel URLs since the timestamp.

    Since

    3.0.180

    Declaration

    Swift

    @objc
    public static func getEmoji(
        _ emojiKey: String,
        completionHandler: ((_ emoji: Emoji?, _ error: SBError?) -> Void)? = nil
    )

    Parameters

    emojiKey

    The emoji key

    completionHandler

    The handler block to execute after request is completed

  • Requests updated channels and deleted channel URLs since the timestamp.

    Since

    3.0.180

    Declaration

    Swift

    @objc
    public static func getEmojiCategory(
        _ categoryId: Int64,
        completionHandler: ((_ emojiCategory: EmojiCategory?, _ error: SBError?) -> Void)? = nil
    )

    Parameters

    categoryId

    The category ID

    completionHandler

    The handler block to execute after request is completed

User