当我为 class 创建新实例时,在 Swift 中获取 nil 值

Getting nil values in Swift when i create new Instance to the class

我在 swift 中为 class 创建新实例时遇到问题。我在 httpUtils 中将字典设置为 HttpVo class,但无法通过为相同的 class.

创建新实例来在其他地方获取该字典

谢谢

This is my demo project you can download source code here

你的方法 callApiWithData return 对象 HttpResponseVO.

您在 ViewController.swift 中创建了一个新实例,但您没有设置任何内容。

试试吧。

self.httpVO = self.httpHelper.callApiWithData(dictParams, url: BASE_URL, httpType: httpType)