当阿波罗查询API调用然后获得零值

时间:2019-07-03 04:57:25

标签: ios swift apollo

当iam调用此突变时,我得到了错误线程1:EXC_BAD_INSTRUCTION(代码= EXC_I386_INVOP,子代码= 0x0)

这是我的代码

apollo.fetch(query: GetReasonsQuery()){ (result, error) in

            let userreports = result?.data?.getReasons
            if userreports?.count == 0 || (userreports?.isEmpty)! || userreports == nil
            {
              print("error")  
            }

            else
            {

                for i in 0...(userreports?.count)!-1
                {
                    let index = userreports![i]
                    self.productIdArr.append(index!.id)
                    self.nameArr.append(index!.name!)
                    self.statusArr.append(index!.status!)
                    self.imageArr.append(index!.image!)

                }
            }
    }

0 个答案:

没有答案