重新连接到互联网后领域同步不起作用

Realm sync not working after reconnecting to the internet

当用户连接到对象服务器(登录)时,我在与领域对象服务器同步时遇到了问题,然后关闭互联网,将新项目添加到数据库,然后打开互联网 - 数据未同步。
Android 应用程序使用 4.3.1 领域构建

//sync
SyncUser.loginAsync(syncCredentials, urlRealm, new SyncUser.Callback<SyncUser>() {  
@Override
public void onSuccess(SyncUser user){
      syncAccount = new SyncConfiguration
           .Builder(user, urlAccount)
           .waitForInitialRemoteData()
           .name("account_"+userId+".realm")
           .modules(new AccountSchemaModules())
           .errorHandler((session, error) -> {
               Log.e("REALM", "error = " + error.getMessage());})
           .build();

                  syncAccount.shouldDeleteRealmOnLogout();

                  Realm.getInstanceAsync(syncAccount, new Realm.Callback() {
                      @Override
                      public void onSuccess(Realm realm) {
                          syncUserSuccess();
                      }
                  });
              }
          }

//then access to configuration 
Realm.getInstance(syncAccount);

我已尝试 运行 在互联网恢复时通过调用进行同步:

syncAccount.getUser().allSessions().get(i).uploadAllLocalChanges();

但也无济于事

更新

我有 3 个 SyncConfiguration,它们对 SyncUser.loginAsync 连接使用相同的凭据。这可能是原因吗?我也尝试使用相同的 SyncUser 进行配置,但结果是一样的

是否可以手动登录 out/log 连接?或者正确的方法是什么?我试过:

syncAccount.getUser().logout()

但比 SyncConfiguration 我得到一个错误:"Configurations cannot be different if used to open the same file."

更新 2 当我关闭互联网时,我在日志中看到:

E/REALM_SYNC: Connection[2]: Failed to resolve 'url:9080': Host not found (authoritative)
E/REALM_JAVA: java.lang.IllegalArgumentException: Unknown error code: 3
                                                           at io.realm.ErrorCode.fromInt(ErrorCode.java:195)
                                                           at io.realm.SyncSession.notifySessionError(SyncSession.java:170)
                                                           at io.realm.SyncManager.notifyErrorHandler(SyncManager.java:324)
D/REALM_SYNC: Connection[2]: Reconnecting in 795 milliseconds

但我在收到该消息后没有在日志中看到任何重新连接

当我尝试将项目添加到数据库时,我在日志中看到如下项目:

V/REALM_JNI:  --> Java_io_realm_internal_OsSharedRealm_nativeIsClosed -979144320
V/REALM_JNI:  --> Java_io_realm_internal_OsSharedRealm_nativeBeginTransaction -979144320
V/REALM_JNI:  --> Java_io_realm_internal_OsSharedRealm_nativeIsClosed -979144320
V/REALM_JNI:  --> Java_io_realm_internal_OsSharedRealm_nativeIsClosed -979144320
V/REALM_JNI:  --> Java_io_realm_internal_UncheckedRow_nativeGetIndex -979283168

和我遇到的情况一样,之后我打开互联网并将项目添加到数据库。

稍后我发现消息:

D/REALM_JAVA: Network request (authenticate): url
D/REALM_JAVA: AuthenticateResponse. Identity 9d83f9775ebba4deac9003d336b9f4c4; Path /account_1
D/REALM_JAVA: Access Token refreshed successfully, Sync URL: 
V/REALM_JNI:  --> Java_io_realm_SyncSession_nativeRefreshAccessToken
D/REALM_JAVA: Scheduling an access_token refresh in 349573 milliseconds

但服务器端仍然没有更新

该问题仅出现在 4.3.0 版本中,现已在 4.3.2 中修复 谢谢