0

我正在尝试从服务器获取数据Realm并将其发送到服务器retrofit,用于解析和序列化我正在使用LoganSquare

  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 回答