After upgrading Realm from 10.28.1 to 10.33.0, my app crashes whenever func configuration<T: BSON>(partitionValue: T) is called.
The error message only says, “RealmSwift/Sync.swift:314: Fatal error: what’s best in this case?”.
What is “this case”??? Does anybody know what is happening?
The strange thing is that it works fine on a simulator. It only crashes on a device.
According to the Atlas log, Authentication → login is OK. But it crashes when I try to get a config for the user.
let configuration = user.configuration(partitionValue: Constants.REALM_PARTITION)
I know that the default clientResetMode is switched from .manual to .recoverUnsyncedChanges in 10.32.0.
I tried to specify manual. But it didn’t help. I get the same fatal error.
let configuration = user.configuration(partitionValue: Constants.REALM_PARTITION, clientResetMode: ClientResetMode.manual())
Can you clarify the question a bit? The code provided doesn’t really tell us about what’s being passed in your functions. For example this could be an issue
let configuration = user.configuration(partitionValue: Constants.REALM_PARTITION)
as we don’t know what Constants.REALM_PARTITION resolves to. Can you provide a bit more code and details?
Also, when you tried .manual did you define a recovery handler?
Are you verifying that user is a valid, authenticated user?
Constants.REALM_PARTITION is a partition value in String. I don’t know if this is helpful. But it is defined as "songbook=default".
No, I didn’t define a recovery handler when I tried .manual.
user is a valid user. I can print it and confirm the user id. user comes from app.login(credentials: Credentials.anonymous), or if let user = app.currentUser.
This is what I get when I print User and Realm.Configuration.
on Device
user.id: 6391d6eb2012602a8e1ae433
RealmSwift/Sync.swift:314: Fatal error: what's best in this case?
I rebuilt the app with 10.28.1. And I now get the same fatal error on a device. (It works on a simulator.) So, I guess it has nothing to do with ClientResetMode.
If I reinstall the already published app (that uses 10.28.1), it works perfectly fine on the device.
While upgrading to 10.33.0, I had to change some build settings for the latest XCode. Maybe that messed something up. But in any case, RealmSwift/Sync.swift:314: Fatal error: what's best in this case? is not a very helpful message. It appears that line 314 of Sync.swift is a comment. How can I troubleshoot from here?
Everything works now. It wasn’t the code or realm binary.
I was using Carthage as a dependency manager. During the upgrade process, I did a framework migration. It turned out that the migration was incomplete. The project settings had a link to old frameworks.