Crash in SendbirdChatSDK serialize() Function in Swift

Hello Sendbird Community,

I’m experiencing a crash in my iOS application using SendbirdChatSDK. The crash occurs specifically at the line where I call the serialize() function on a KCSUserMessage object. Here are the details:

  • Sendbird SDK Version: SendbirdChatSDK - 4.12.0
  • iOS Version: 17.0 and upper
  • Development Environment: Xcode 15

Code Snippet:

do {
    if let lSerialize = try sbMessageRef.serialize() {
        chatMessage.payload = lSerialize
    } else {
        print("Warning: sbMessageRef.serialize() returned nil")
    }
} catch {
    print("Error serializing sbMessageRef: \(error.localizedDescription)")
}

Crash Details:

  • The crash is logged on Firebase, and it points to the serialize() function call.
  • The error message often indicates an issue with the underlying socket connection or data serialization.

Steps to Reproduce:

  1. A user sends or receives a message.
  2. The app attempts to serialize the message using sbMessageRef.serialize().
  3. The app crashes intermittently at this point.

What I’ve Tried:

  1. Updating the SDK: Ensured the SDK is updated to the latest version.
  2. Exception Handling: Wrapped the serialize() call in a do-catch block to handle exceptions.
  3. Data Integrity: Verified that the data within sbMessageRef is not corrupted before calling serialize().

Despite these efforts, the crash persists.

Request:

  • Has anyone else experienced this issue with the serialize() function?
  • Are there any additional steps or configurations recommended to prevent this crash?
  • Is there a specific version of the SDK that addresses this issue more robustly?

Any help or insights from the community would be greatly appreciated. Thank you!