我正在尝试登录 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/