'RLMException', reason: 'Opening Realm files of format version 11 is not supported by this version of Realm'

Viewed 1704

I am trying to login into realm but it keeps throwing the RLMException error.

This my pod file

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

target 'App' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!

# Pods for App
pod 'RealmSwift'

target 'AppUITests' do
  # Pods for testing
end

end

This is the login function

func login(){
    
    let usernameCredentials = SyncCredentials.usernamePassword(username: "user", password: "password")
    // Create the configuration
    let syncServerURL = URL(string: "realms://jaffjf.faf.cloud.realm.io/default")!
    SyncUser.logIn(with: usernameCredentials, server: syncServerURL) { user, error in
            if let user = user {
                print("logged in",user)
                 let config = user.configuration(realmURL: syncServerURL);

            // Open the remote Realm
            let realm = try! Realm(configuration: config)
          
            
              Realm.asyncOpen(configuration: config) { realm, error in
                        if let realm = realm {
                          
                            let results = realm.objects(Temp.self)
                            print("This is the results......", results)
             
           
                        } else if let error = error {
                        
                            print("No realm found....")
                        }
                    }
            
        } else if let error = error {
            
        }
    }
    

Terminating app due to uncaught exception 'RLMException', reason: 'Opening Realm files of format version 11 is not supported by this version of Realm' *** First throw call stack:

what is causing the error and how can I fix it?

2 Answers

This error indicates you need to be using Realm Cocoa 5.4.x, at this moment in time the latest version is 5.4.5.

Just open finder of file path and remove realm files. Then build you project again.

I resolved same problem this way.

Related