Chat data is not updating, while app comes from background to foreground

When App goes in the background or offline, after some time user comes to the online or foreground, not able to load the latest messages in the chat screen as well as in the Group list screen last messages and message counts are not updating.

@Thangarajan,

Could you tell us what version of iOS you’re testing on, and what versions of the iOS SDK and SyncManager SDK you’re utilizing?

Thanks!

Hi @Tyler, I am using iOS 13.5.1 and SendBirdSyncManager pod version is,
SendBirdSDK (3.0.211)
SendBirdSyncManager (1.1.34):

The main issue is in the group list screen total message count and last message not able to update

When you go from being in the background to the foreground, are you reconnecting to Sendbird?

Yes, the pull to refresh is working.

Are you referring the pull down to refresh? I’m thinking more about when you bring the app back into the foreground, are you reconnecting to Sendbird (without pulling down to refresh)?

Yes, I am reconnecting.

I saw your document somewhere mentioned if App comes from background to foreground, the data syncing will take some time, My question is after syncing you guys given any callback on the Group list page.

any update on this issues?

Hi @Thangarajan,
Upon reconnection, are you resuming the synchronization of the SyncManager and then calling a fetch method to update the collection in your chat view controller? This should help with fetching additional messages then.

For example:

func didSucceedReconnection() {
    SBSMSyncManager.resumeSynchronize()
    self.collection.fetchAllNextMessages { (hasMore, error) in
        guard error == nil else {
            // Handle error.
        }

        ...
   }
}

Find more information about the fetchInDirection and fetchAllNextMessages methods here:

Hi @janna-sendbird, Thank you. On the chat screen, it’s working. But in Group list screen is not working.