Closed mrezk closed 1 year ago
Hi @mrezk You may want to try our writeCopy
API for this. It allows you to copy a Realm with a different configuration
try realm.writeCopy(configuration: Realm.Configuration(fileURL: backupURL, readOnly: true, schemaVersion: 0))
where backupURL
is the path to your synced Realm.
This is the API
https://github.com/realm/realm-swift/blob/66cf2fc246f87c06940e6c3a6dc5908c316fa5d6/RealmSwift/Realm.swift#L1037
Hi Diana, thanks so much for your reply!
I checked writeCopy but I think it works the other way around, copying the invoked realm to the specified configuration, is that right?
Tried to use writeCopy but I can't write a copy if I can't open the synced realm =(
Hi @mrezk you would probably would have to do a two step update for this. First you would need to update to a Realm version v4 or v5 to update the file to a version that can be used by v10. Second, you will be able to open the file and use writeCopy to copy the file with a local configuration. Let me know if this is helpful and you were able to solve your issue.
Hi @dianaafanador3, thanks again for your response!
I thought of doing a two step update but I worry that some users can be left "hanging" (losing their data) if they happen to skip the "bridge" version. Will try it at let you know cause some older RealmSwift versions are not compatible with some newer XCode versions.
Thanks again for your help, will update this issue as soon as I try it!
Hi Diana, I can confirm I could upload a build to the AppStore using XCode 14 and RealmSwift v5.5.1. I guess I will have to stay for some time (a year or so) before burning the bridge.
Thanks again for replying, it's a very specific issue and I wasn't expecting a quick reply =)
@mrezk If I may suggest having a force update will help a lot to force user into updating to a version which uses v5.5.1. Closing this as resolved, if you have any issues updating to v10 please open another issue.
How frequently does the bug occur?
All the time
Description
Hi!
I've been using Realm in my apps at least since 2017. I started using ROS along with a CloudKit token to sync all the user's data. I had to stick with RealmSwift v3.10.0 for a long time since that was the last version to support the self hosted version of ROS. Now I am trying to update to the latest RealmSwift version (without supporting sync), but I need a way to migrate my old user's synced realm to a plain local realm. I couldn't find a way to generate the configuration I used before to open the synced realm. I was able locate the synced realm file inside the AppContainer but when I try to open it I get the expected "Incompatible histories. Expected a Realm with no or in-realm history, but found history type 3" error. I then tried to open the synced realm in read-only mode and I get the error "The Realm file format must be allowed to be upgraded in order to proceed.".
I downloaded Realm Studio 5.0 and I could open the local stored synced realm successfully, so I have a little bit of hope there could be a workaround to be able to migrate the data.
I know it's a very specific issue and it involves a very old RealmSwift version, but if @tgoyne or any of the Realm long time contributors can give me a hint of what I can do, it would mean the world to me. I already scanned all the issues and documentation I could find.
Thanks!
Stacktrace & log output
No response
Can you reproduce the bug?
Yes, always
Reproduction Steps
No response
Version
v10.32.1
What SDK flavour are you using?
Local Database only
Are you using encryption?
No, not using encryption
Platform OS and version(s)
iOS 16.0.2
Build environment
Xcode version: 14.0.1 Dependency manager and version: Cocoapods 1.11.3