我正在使用 SOAP 开发 swift3。我收到了 soap 的回复,但我无法将此回复发送到我的 secondView Controller
Body: <<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-
ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body>
<ns1:doRegisterUserResponse
xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"><response><status
xsi:type="xsd:string">successful</status></response>
</ns1:doRegisterUserResponse></SOAP-ENV:Body></SOAP-
ENV:Envelope>>.value
Response = successful
我试着通过
override func prepare(for segue: UIStoryboardSegue, sender: Any?)
{
if (segue.identifier == "secondView")
{
let DestViewController1:secondViewController = segue.destination as! secondViewController
DestViewController1.responseText = self.value(forKey: status as String) as! String!
}
}
请帮忙谢谢
最佳答案
当您说“无法发送此回复”时,您是什么意思? - 无法编译代码 - 执行时崩溃 - 似乎一切正常,但没有任何更新?
为了帮助清楚起见,您不应该使用大写的变量名称 - DestViewController1
应该只用于定义类或结构,而 destViewController1
将是一个更好的变量名 - secondViewController
应该是 SecondViewController
- 第二个 Controller 中是否有变量
responseText
? - 您在哪里保存 SOAP 响应?
self.value()
好像没什么意义。你是说 self.responseText.value()` 吗?
关于ios - 如何在 swift3 中将 soap 响应传递给下一个 viewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42082682/