1.这是我使用改装错误的时候
第一步:
public interface RequestService {
@POST ("home/indexThree")
Call<RequestBody> getHomeinfo(@Body RequestBody info);
}第二步:
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(url)
.addConverterFactory(GsonConverterFactory.create())
.build();
RequestService requestService = retrofit.create(RequestService.class);
RequestBody body = RequestBody.create(JSON, jsonObject.toString());
Call<RequestBody> homeinfo = requestService.getHomeinfo(body);
homeinfo.enqueue(new Callback<RequestBody>() {
@Override
public void onResponse(Call<RequestBody> call, Response<RequestBody> response) {
System.out.println("response"+response.body().toString());
}
@Override
public void onFailure(Call<RequestBody> call, Throwable t) {
System.out.println("onFailure"+t.getMessage().toString());
}
});我在网上搜索了很长一段时间。但是没有用。请帮助或尝试给出一些如何实现这一目标的想法。谢谢!
发布于 2017-03-22 19:12:55
使用来自服务器的响应的正确调用模型类,这些错误显示是因为您使用了调用。
https://stackoverflow.com/questions/41757477
复制相似问题