3

We are using MongoDB Realm in our app.

The first time the user is connected to the app, the ProgressNotifcation callback is triggered correctly, and it will work and trigger whenever a new download is coming. Even if no download is pending, the ProgressNotification callback will be triggered (the Progress object pass in the callback will contain values from the last download) at least once(when creating it). I supposed this is due to the fact that we are downloading the first data set of the user.

But after killing the app and launching it again, the ProgressNotification callback is not triggered anymore until new data are received by the app. And from this point, the callback will be called every time we need it.

It seems that now, the framework needs a first download since the app is launch to make ProgressNotification callback to be triggered every time we need it.

This was working in the previous version of Realm (5.X.X). We just finished the migration to Realm 10 and discover this issue. I am a bit stuck here, do not know if this is an intended change or a bug on my part. But I am pretty sure this was working in the previous version of the SDK.

Can anyone help me with this? Thanks

Note: this is no more working in both mode : .forCurrentlyOutstandingWork and .reportIndefinitely

Example

self.token = syncSession.addProgressNotification(for: .download, mode: .forCurrentlyOutstandingWork) { progress in
                           .......Some code........   <- this part of the code is not triggered anymore
}

EDIT - 21/12/2020

For clarification, the token returned contains a value and the .invalidate is not being called.

There is no error in the session and any new download is triggering the callback. After an initial download, everything works as expected. This means that when I add a progressNotifcation later on, the callback is triggered immediately with the progress of the previous download. But if there is not an initial download, the callback is never called.

For the scope, this method is actually in the custom publisher that I created and it is not deallocated.

Realm 10.5.0

iOS 14.3

Erdem Inan
  • 41
  • 3
  • The question is a bit vague and there could a bunch of reasons that code is not working which may not have anything to do with that code. It would be a good idea to do some troubleshooting; when the code is called is `self.token` populated? Did the session experience an error? Are there any actual additional bytes to download? Is the view containing the code going out of scope or is .invalidate being called on the token? Please clarify and update the question and we'll take a look. – Jay Dec 18 '20 at 15:56
  • @Jay Hello, thanks for the reply! I updated the question with some info that you asked. – Erdem Inan Dec 21 '20 at 08:11

0 Answers0