swift - 'RLMException',原因 : 'Opening Realm files of format version 11 is not supported by this version of Realm'

标签 swift realm

我正在尝试登录 Realm ,但它不断抛出 RLMException 错误。
这是我的 pod 文件

# 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 {
            
        }
    }
    

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:


是什么导致了错误,我该如何解决?

最佳答案

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

关于swift - 'RLMException',原因 : 'Opening Realm files of format version 11 is not supported by this version of Realm' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62813808/

相关文章:

arrays - 如何在 Swift 中初始化包含枚举数组的结构数组?

iOS - 根据开关值启用/禁用一组通知

java - 类型 '[io.rearealm.com_example_myapplication_UserRealmProxy]' 的未关闭文件;这些类型不会经过注释处理

ios - 如何使 Asynctask 中的 UIView 无效(swift,ios)

ios - 通过检查状态自动更新 Swift 中的标签

java - 合并多个 RealmList 并对结果列表进行排序?

ios - 访问 Realms 对象列表时出错 : Realm accessed from incorrect thread

android - 查找父级 id 为 X 的所有子 Realm 对象

swift - 具有不相关托管对象上下文的 Google 地点选择器的 CoreData 线程问题

java - 使用Jack编译器编译Realm项目