Firestore无法上传列表

时间:2019-01-19 16:01:51

标签: android google-cloud-firestore

我尝试从Firestore下载的ArrayList>中存储以前的新项目。下载过程正在运行,但是在编辑列表后,我无法再次上传,因为firestore表示它必须是Map。因此我尝试使用 #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct s { char *value; } S; S list[2]; void function( ) { char val1[] = "val1"; char val2[] = "val2"; //Note that you are creating a copy of "val1" here which can be avoided by changing it to char *val1 = "val1"; list[0].value = malloc(strlen(val1)+1); //allocate space for val1 + NUL-terminator strcpy(list[0].value, val1); //copy string list[1].value = malloc(strlen(val2)+1); strcpy(list[1].value, val2); //You could also use the function strdup which allocates memory and duplicates the string //list[0].value = strdup(val1); printf("%s\n", list[1].value); //prints val2 } int main(int argc, char** argv) { function(); printf("%s", list[1].value); free(list[0].value); //Don't forget to free. free(list[1].value); return 0; } 问题是如果我使用此代码,它说不支持嵌套数组。这是完整的代码:

Map<String, Object> listValue = new HashMap<>();
        listValue.put("shoppingLists", Arrays.asList(shoppingLists));

0 个答案:

没有答案