0

私は使用している解析とシリアライズのために、サーバーからデータをフェッチRealmしてサーバーに送信しようとしていますretrofitLoganSquare

  client =  new Retrofit.Builder()
                         .baseUrl(REST_ENDPOINT)
                         .client(okHttpClient)
                         .addConverterFactory(LoganSquareConverterFactory.create())
                         .build();

これが私がレコードにアクセスする方法です

Appointment appointments = DB.getInstance(mContext).selectNotSyncAppointmentsData();
        RestApi.AppointmentsDataApi service = getAppointmentsDataApi();
        Call<APResponse> call = service.createUpdateAppointmentsData(appointments);

次のエラーが表示されます

createUpdateAppointmentData : onFailure Class io.realm.AppointmentRealmProxy could not be mapped to a JSON object. Perhaps it hasn't been annotated with @JsonObject?
4

1 に答える 1

0

LoganSquare がどのように機能するかはよくわかりませんが、Realm は、すべてのモデル クラスを拡張するプロキシ クラスと呼ばれるもので機能することに注意してください。これらは と呼ばれているので認識できます<ModelClass>RealmProxy。これらのサブクラスを認識するように LoganSquare を構成する方法を何とか見つけなければならないようです。

または、 を使用することもできますrealm.copyFromRealm(appointments)。これにより、正しいクラスのすべてのデータのメモリ内コピーが得られます。

于 2016-05-04T10:10:13.100 に答える