0

我在运行时收到错误 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)
                }
            }
4

1 回答 1

0

尝试在 for 循环中进行转换

for object in objects as [PFObject]

然后你也不必再把它扔进去。

于 2015-04-02T12:33:49.980 回答