(iOS)SBSMMessageCollection.fetch doesn't complete

sometimes on a channel when calling SBSMMessageCollection.fetch doesn’t call the completion handler.

collection.fetch(in: .previous, completionHandler: { (hasMore, error) in
//this completion never gets called... so the fetch for next messages doesn't get called either.
    collection.fetch(in: .next, completionHandler: { (hasMore, error) in

Can you provide the reproducible steps when fetch doesn’t call the completion handler?

1 Like

HI imju, sure
when the user selects the chat, we connect to the channel, initialize the chatViewController and pass the channel object to that controller. then on view did load we initialize the messageCollection as the example on the SyncManager Message Sync .
here is a code sample of our view controller. the issue doesn’t happen always, but once it happens on a channel, the issue will always happen on the channel, sometimes after a while it gets fixed on it’s own, sometimes receiving a message on that channel will fix it.

var channel : SBDGroupChannel!
var messageCollection: SBSMMessageCollection?
let filter = SBSMMessageFilter(messageType: .all, customType: nil, senderUserIds: nil)
override func viewDidLoad() {
self.messageCollection = SBSMMessageCollection(channel: self.channel, filter: self.filter, viewpointTimestamp: lastSeenAt ?? LONG_LONG_MAX)
self.messageCollection?.delegate = self

override func viewWillAppear(_ animated: Bool) {
    if !firstVWAppear{
        firstVWAppear = true

func getMessages(){
    self.messageCollection?.fetch(in: .previous, completionHandler: { (hasMore, error) in
    //this completion 👆🏼 never gets called... so the fetch for next messages doesn't get called either.
        self.messageCollection?.fetch(in: .next, completionHandler: { (hasMore, error) in
            // UI Code

Thanks for the response. Which version are you using? Can you upgrade the sync manager and SDK version to the latest? Please let me know if the issue still comes up and provide the SDK and sync manager version.

1 Like

HI Imju, thanks for keeping in touch with the issue, I can’t upgrade the sync manager because doing so, causes another bigger issue… SBSMChannelCollectionDelegate when receiving a new message triggers twice the .update event which hasn’t been solved.
right now I did update and see there is even a newer version than the one in the attached post but still has the bigger issue… If you could help with this other issue since I haven’t had any more updates on it, or is there any phone number I can contact like engineering support or something…

  • SendBirdSDK (3.0.185)
  • SendBirdSyncManager (1.1.24):
    • SendBirdSDK (~> 3.0.178)

@Cris_Warren I see that you had a previous thread about syncmanager. We cannot reproduce this on our side unfortunately. If you are our customer, you can submit a ticket from your dashboard, then we can continue from there. Let me know.