LeanCloud SDK版本号4.7.9 使用Android Studio 3.3开发
参照数据存储快速入门Demo中的商品发布代码后,我的代码如下
AVObject product = new AVObject("Product");
product.put("have", iHave.getText().toString());
product.put("want", iWant.getText().toString());
product.put("qq", nectqq.getText().toString());
product.put("owner", AVUser.getCurrentUser());
product.put("image", new AVFile("pic", imageBytes));
if (checkBox_ex.isChecked()){
product.put("exchange", true);
}
if (checkBox_re.isChecked()){
product.put("reward", true);
}
if (checkBox_ge.isChecked()){
product.put("get", true);
}
product.saveInBackground(new SaveCallback() {
@Override
public void done(AVException e) {
if (e == null){
put_progress.setVisibility(View.GONE);
PublishActivity.this.finish();
}else {
put_progress.setVisibility(View.GONE);
Toast.makeText(PublishActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
}
});
}
基本上和参考代码差不多,下面是我参考的代码(数据存储快速入门Demo)
AVObject product = new AVObject("Product");
product.put("title", mTitleEdit.getText().toString());
product.put("description", mDiscriptionEdit.getText().toString());
product.put("price", Integer.parseInt(mPriceEdit.getText().toString()));
product.put("owner", AVUser.getCurrentUser());
product.put("image", new AVFile("productPic", mImageBytes));
product.saveInBackground(new SaveCallback() {
@Override
public void done(AVException e) {
if (e == null) {
mProgerss.setVisibility(View.GONE);
PublishActivity.this.finish();
} else {
mProgerss.setVisibility(View.GONE);
Toast.makeText(PublishActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
}
});
结果除了图片以外的其他信息都上传成功了,只有图片一栏没有记录,AVFile中也什么都没有,也没有报错啥的,如图
请问这是什么原因呢?
-
创建时间
19年2月15日
-
最后回复
19年2月15日
-
4
回复
-
1.8K
浏览
-
2
用户
-
1
链接