Swift ';RLMEException';,原因:';此版本的Realm';不支持打开格式为11的Realm文件;

Swift ';RLMEException';,原因:';此版本的Realm';不支持打开格式为11的Realm文件;,swift,realm,Swift,Realm,我试图登录到领域,但它一直抛出RLMEException错误 这是我的吊舱文件 # 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 p

我试图登录到领域,但它一直抛出RLMEException错误

这是我的吊舱文件

# 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
这是登录功能

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 {
            
        }
    }
    
由于未捕获的异常“RLMException”而终止应用程序,原因:“此版本的领域不支持打开格式为版本11的领域文件” ***第一次抛出调用堆栈:


导致错误的原因是什么?如何修复它?

只需打开文件路径查找器并删除领域文件。 然后再次构建您的项目


我用这种方法解决了同样的问题。

此错误表明您需要使用Realm Cocoa 5.4.x,目前最新版本是5.4.5。

我对Realm一点也不熟悉,但此错误消息非常有意义:您使用的版本不支持文件格式。您是否更新了服务器端Realm版本,而不是客户端Realm版本?您的同步领域文件的版本似乎比您的领域swift版本支持的版本更新。请检查5.0.0及以后的所有版本,因为Realm Studio将对您的领域进行更改,并且还有一些API版本更改。请澄清此过程。我不明白你做了什么