我无法获取数据并写入String变量。
当我这样做时:
Optional({
TD = {
Entry = 44;
Name = Tedd;
Potential = 32;
StopLoss = 77;
};
})
我得到所有这些记录(在类型中 - AnyObject):
{{1}}
但是我需要“Entry”,“Name”,“Potential”,“StopLoss” - 放入变量,然后放到textfield ......
请帮助理解,我该怎么做。 我已经找不到解决方案已经4个多小时.... 感谢。
答案 0 :(得分:1)
You are trying to print a value associated with a key. ( a key:value pair)
The key you are specifying is "02-03-2016" and that key doesn't seem to exist.
Assuming your structure is
Entry = 44; Name = Tedd; Potential = 32; StopLoss = 77;
Then your keys are Entry, Name, Potential and StopLoss
print(snapshot.value.objectForKey("Entry")
would print
44