使用SwiftyJSON解析parse.com数组时出错

时间:2015-04-02 09:52:04

标签: ios json swift swifty-json

我收到错误Swift动态类型转换在运行时失败。解析表中的选项是一个数组

   if let objects = objects as? [PFObject] {
                for object in objects {
                    println(object.objectId)
                    let pf = object as PFObject
                    let name = pf["Question"] as String
                   // let data1 = pf["Options"] as? NSData
                    let jsonData: NSData = pf["Options"] as NSData!
                    let json = JSON(data: jsonData)
                    self.myArray = json.arrayObject as Array<String>
                    println(name)
                    self.question.text = name


                   // println(answers1)
                }
            }

1 个答案:

答案 0 :(得分:0)

尝试在for循环中进行投射

for object in objects as [PFObject]

然后你不必在其中再次施放它。