gpt4 book ai didi

android - 如何在 QuickBlox 自定义表中创建新记录

转载 作者:行者123 更新时间:2023-11-30 03:18:24 25 4
gpt4 key购买 nike

想要在已创建的 QuickBlox 自定义表中创建新记录。我有 遵循指南 Url 并使用下面的方法,这里我使用我的表名

HashMap<String, Object> fields = new HashMap<String, Object>();

fields.put("User ID",String.valueOf(myID));
fields.put("senderLoginID", ""+mylogin.toString());
fields.put("receiverLoginID", ""+friendLogin.toString());
fields.put("messages", messageString);

fields.put("isRead", false);


QBCustomObject qbCustomObject = new QBCustomObject();
qbCustomObject.setClassName("Movie"); // your Class name
qbCustomObject.setFields(fields);
QBCustomObjects.createObject(qbCustomObject, new QBCallbackImpl() {
@Override
public void onComplete(Result result) {
if (result.isSuccess()) {
QBCustomObjectResult qbCustomObjectResult = (QBCustomObjectResult) result;
QBCustomObject qbCustomObject = qbCustomObjectResult.getCustomObject();
Log.d("New record: ",newCustomObject.toString());
} else {
Log.e("Errors",result.getErrors().toString());
}
}
});

点赞时出错

** '{"errors":{"base":["Forbidden. Need user."]}}'
… Request has been completed with error: [base Forbidden. Need user.]

最佳答案

首先,你不需要使用这个

fields.put("User ID",String.valueOf(myID));

此字段将根据您的 token 信息在服务器上填写

接下来,您必须登录才能创建记录,做下一步

http://quickblox.com/developers/SimpleSample-users-android#Sign_In_.26_Social_authorization

关于android - 如何在 QuickBlox 自定义表中创建新记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19630934/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com