Uploaded image for project: 'Realm Cocoa SDK'
  1. Realm Cocoa SDK
  2. RCOCOA-840

Open encrypted Realm DB with Realm studio get error "Opening Realm files of format version 0 is not supported by this version of Realm"

      !!! MANDATORY TO FILL OUT !!!
      <!---

      Questions: If you have questions about HOW TO USE Realm, ask on
      StackOverflow,
      or in our Swift Forum or Obj-C Forum.

      Feature Request: Just fill in the first two sections below.

      Bugs: To help you as fast as possible with an issue please describe your issue
      and the steps you have taken to reproduce it in as many details as possible.

      -->

      Goals

      <!--- What do you want to achieve? -->

      1. open the encrypted Realm DB with realm studio
      2. perform CRUD without error in my program

      Expected Results

      1. open the DB file with realm studio I should get one of the following results:
        (1) it is opened correctly without any info
        (2) asking me to upgrade the DB file before opened
        (3) show me "Opening Realm files of format version x is not supported by this version of Realm" x is bigger than 0.
      2. when running my program: if one of the first two options of 1 is met, the program will not crash; if it is the third condition, I could upgrade the realm to solve the problem.

      Actual Results

      1. open the DB file with realm studio, and it show me "Opening Realm files of format version 0 is not supported by this version of Realm"
      2. perform CRUD in my program and it crashes with info "The Realm file format must be allowed to be upgraded in order to proceed."

      Upgrade the realm studio or the realm version of my program will not help.

      More Info

      1. if do not encrypt, everything works fine !
      2. if encrypt, when I wrote all the datas which make the file size bigger than 100MB, error happen. But If I wrote part of the datas which make the file size around 40MB, no error happen.

      Code Sample

      • (RLMRealm *)_defaultRealm {
        RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];
        config.fileURL = [[config.fileURL URLByDeletingLastPathComponent]
        URLByAppendingPathComponent:REALM_NAME];
        [RLMRealmConfiguration setDefaultConfiguration:config];
        NSError *error;
        RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:&error];
        if (error) { NSLog(@"Error opening realm: %@", error); return nil; }
      return realm;
      

      }

      [realm transactionWithBlock:^

      { [realm addObjects:objs]; NSLog(@"realm create finish!"); }

      ];

      [realm writeCopyToURL:[NSURL URLWithString:documentPath] encryptionKey:key error:&error];

      Version of Realm and Tooling

      <!---
      In the CONTRIBUTING guidelines, you will find a script,
      which will help determining some of these versions.
      -->
      Realm framework version: tried all main version

      Xcode version: XCode 11

      iOS/OSX version: 13.3

            Assignee:
            jorgen.edelbo@mongodb.com Jørgen Edelbo
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: