var message:String=""
을 global variable
으로 설정했습니다. 그 값을 다른 ViewController
에서 prepareForSegue
까지 보내야 만합니다. 그러나 nil
값을 보내고 있습니다. 어떤 방법으로 최신 값을 segue로 보낼 수 있습니까? ? 감사 전역 변수 : var message2="bob"
Segue는 계산하기 전에 nil 값을 보냅니 까?
SEGUE 방법을 준비 :
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if (segue.identifier == "submitSegue") {
let svc = segue.destinationViewController as! Otpscreen;
svc.otpname = username.text!
svc.otppass = password.text!
svc.otp=message2
}
}
내가 값을 계산하고있어
다른 방법 : 코드의 잘못된
func findMatch()->Void
{
print(username.text!+password.text!)
let authenticate=username.text!+password.text!
//line where i calculated hash
print(hash)
let num=strtoul(hash,nil,16)
print(num)
let finalhash=String(num)
let soap = SOAPEngine()
soap.responseHeader = true;
soap.setValue(username.text!, forKey: "userName")
soap.setValue(password.text!, forKey: "password")
soap.setValue(finalhash, forKey: "hashKey")
let dict:Dictionary = try! soap.syncRequestURL("someUrl", soapAction: "send method ") as Dictionary
NSLog("%@", dict);
let returnmessage=(dict["Body"]!["sendOTPResponse"]!!["sendOTPReturn"]!!["string"]!![1])
print(returnmessage)
message2=returnmessage as! String
}
일부 코드보기 –
스토리 보드의 코드와 화면을 보여주십시오. –
먼저 글로벌 변수를 사용하면 안됩니다. 두 번째 당신은'viewDidLoad'에서 값에 접근하려고합니까? 셋째,'prepareForSegue'에 대한 코드와 대상보기 컨트롤러에서 메시지에 액세스하는 위치 – Paulw11