android - 标题的值不能从 ReadablenativeMap 转换为字符串
问题描述
InsertDataToServer = () => {
const { pinValue1 } = this.state;
const { pinValue2 } = this.state;
const { pinValue3 } = this.state;
const { pinValue4 } = this.state;
var String_3 = pinValue1.concat(" " , pinValue2);
var String_4 = String_3.concat(" " , pinValue3);
var String_5 = String_4.concat(" " , pinValue4);
fetch("http://www.aonde.biz/mobile/doLogin.php", {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify({
"pin":212,
})
})
.then(response => response.json())
.then(responseJson => {
// Showing response message coming from server after inserting records.
Alert.alert(responseJson);
})
.catch(error => {
console.error(error);
});
解决方案
当代码从以下位置更改时,此错误已修复:
Alert.alert('Error:', error)
至:
Alert.alert('Error:', error.message)
推荐阅读
- android - Android 信号 11 (SIGSEGV),代码 1 (SEGV_MAPERR)
- python - PYTHON:如何使用输入和循环 PYTHON 打印此字符串
- c# - 如何使用 c# 从 azure blob 存储中检索 xml 文件
- javascript - 如何在js中从电子邮件中删除区分大小写
- android - 升级到 v0.19.0 后如何禁用拖动 Compose 寻呼机?
- python - Wxpython 过滤器下拉菜单在最新版本 4.1.1 中不起作用 与 4.0.7 版本相同的示例
- image - Bootstrap 5:模态中的全屏轮播,以各种尺寸的图像为中心
- database - DynamoDB 按需扩展和节流
- angular - 单击重置按钮时表单无效
- flutter - 使用 Draggable Widget - Flutter 时,如何让子小部件动画回到其原始位置?