我是Realm和Android开发的新手,正在尝试从Atlas查询文档。我能够成功地对用户进行身份验证,但是当我尝试执行查询时,我得到了以下错误:E/REALM_JAVA: Session Error[wss://realm.mongodb.com/]: WRONG_PROTOCOL_VERSION(realm::sync::ProtocolError:105): sync client must have a sync protocol version of at least 3 to sync on this application, but found version 2. Please update your application to use a newer SDK
我目前正在开发Android Realm SDK的10.4.0版本和Android SDK平台30。我已经尝试寻找这两个更新,它说,一切都是最新的。下面是我的代码:
app.loginAsync(emailPasswordCredentials, it -> {
if (it.isSuccess()) {
Log.v("AUTH", "Successfully authenticated using an email and password.");
User user = app.currentUser();
String partitionValue = "object_id";
SyncConfiguration config = new SyncConfiguration.Builder(
user,
partitionValue)
.allowQueriesOnUiThread(true)
.allowWritesOnUiThread(true)
.build();
uiThreadRealm = Realm.getInstance(config);
//Debugging - testing Realm Sync queries
Products product = uiThreadRealm.where(Products.class).equalTo("_id", 4).findFirst();
if (product != null) {
Log.v("AUTH", product.toString());
}
Log.v("AUTH", config.toString());
//In-App functions
}有谁有办法解决这个问题吗?
发布于 2021-04-29 09:56:36
在我的例子中,这是因为选择了UUID作为my字段的类型,这是“目前SDK不支持的类型,但它将在未来的版本中使用”。(来自Monogo的支持)。
发布于 2021-08-11 09:04:12
对于那些来自react-native并得到这种错误的人来说
同步客户端必须具有至少为3的同步协议版本才能在此应用程序上同步,但找到版本2。请更新您的应用程序以使用较新的SDK
只需在您的终端中执行
npm install realm然后
cd ios
pod install注意不要破坏更改。
如果需要,在仿真器/仿真器上卸载应用程序,然后
npx react-native run-ios或
npx react-native run-android所以对于Android,我想你也必须更新你的领域包……
https://stackoverflow.com/questions/66910824
复制相似问题