Maybe a slightly general question here as I will be providing very little code, although I will do my best to describe the process and results.
I have an app in production which was released with realmSwift version 10.16.0. This version had the problem that user tokens were not automatically refreshed for Sign In with Apple, therefore, 60 days after an initial login, client sync was silently lost. Clients were still able to save data to their device, however this data were not synced to the server. This silent failure went undetected by myself.
During this time, I made destructive changes to our database. I was comfortable in doing this as code were implemented in the app to handle the client reset. The only problem was, users that had lost connection sync, were not getting the client reset.
Fast forward to now, where we are wanting to release a new version of the app where I have made additional (to the original destructive changes causing the client reset) additive changes to the schema. When a user updates their app they are required to log back in. Upon login they receive the old client reset. An attempt to restore from the old backed-up realm (which includes all of the valuable data that has not been synced to the server) is made, however the following error is received:
The following changes cannot be made in read-only schema mode:\n- Property 'UserObj.name' has been added."
The config used to read the backup realm is as follows:
let config = Realm.Configuration(fileURL: backupURL, readOnly: true)
Effectively, I am unable to read the old realm, preventing me from restoring from the old backup. I have googled around and have found nothing on the error “changes cannot be made in read-only schema mode” - only “Changes cannot be made in additive-only schema mode”
Is there any way to read the old realm in my case?