【发布时间】:2016-03-28 23:40:58
【问题描述】:
我正在尝试快速表示一个 JSON 结构以与 EVReflection 一起使用。字符串如下所示:
{
"date": 2457389.3333330001,
"results":
{
"sun": [[559285.95145709824, 202871.33591198301, 61656.198554897906], [127.6163120820332, 948.44727756795123, 406.68471093096883]],
... etc ...
"geomoon": [[-401458.60657087743, -43744.769596474769, -11058.709613333322], [8433.3114508170656, -78837.790870237863, -26279.67592282737]]
},
"unit": "km"
}
我尝试了几种方法来模拟内部“结果”字典,它以字符串为键,并且始终具有由两个元素组成的数组的值,每个元素都有三个双精度数(即,[String: [[Double]]] 是一个我试过的模型)。无论我做什么,都会出现以下错误:
ERROR: valueForAny unkown type , type _NativeDictionaryStorage<String, Array<Array<Double>>>. Could not happen unless there will be a new type in Swift.
有没有人知道如何对此建模以使 EVReflection 满意?我还从短语Could not happen unless there will be a new type in Swift 中了解到,我可以添加另一种方法或具有显式子类型的不同建模来满足它的需求,但我无法从文档中弄清楚该怎么做。
【问题讨论】:
标签: arrays swift json-deserialization