我正在尝试将以下字典从iOS / Objective-C应用程序保存到Firebase数据库中:
NSMutableDictionary* enrollmentDicc = {
"cleaning_tasks" = 3;
"eat_drink_dairy" = 2;
"eat_gluten" = 1;
"eat_meat" = 1;
"flor_lay_on_mat" = 2;
"garden" = 1;
"hours_spend_standing" = 1;
"level_of_flexibilitity" = 2;
"lift_or_carry" = "3,4,5";
"sit_bed_propped" = 3;
"strech_excercise" = "4,5,6";
"tight_calves" = 2;
"type_shoes" = "4,5,6";
"cause_back_pain" = "3,4";
"chill_sitting_room" = 1;
"cross_legs_sit_down" = 2;
diagnosis = "3,4";
"drive_everyday_hours" = 1;
email = "ignacio.orona+tw@gmail.com";
"has_diagnosis" = 1;
"hours_sitting_down" = 2;
"how_did_you_hear" = 3;
name = ignacio;
painLevelthisMoment = 10;
"pain_location" = 2;
processed = 0;
"sit_soft_couch" = 2;
"sleep_position" = 1;
treatments = "4,10";
为此,我使用以下代码:
-(void) apiPostEnrollment:(NSDictionary*)enrollmentDicc withCompletion:(SingleResponseCompletionBlock)completionBlock
{
_dbNodeRef = [[[FIRDatabase database] referenceWithPath:@"enrolledUsers"] childByAutoId];
[_dbNodeRef setValue:enrollmentDicc withCompletionBlock:^(NSError * _Nullable error, FIRDatabaseReference * _Nonnull ref){
completionBlock(ref,error);
}];
}
我的问题是字典没有保存在Firebase中,我什至没有回调函数的响应(理想情况下,它将为我提供为什么不存储数据的一些线索。我也也没碰到Firebase debug mode。
答案 0 :(得分:0)
问题实际上是字典的某些键中存在隐藏字符(\ x)。消除了那些只有上帝知道哪里的错误隐藏字符,它就像魅力一样起作用。