-2

ユーザーが次のView Controllerにログインするとすぐに、ユーザーのjsonDataを送信し、詳細を表示しようとしています。しかし、そのjsonDataを渡すことができません。firstViewController でグローバル変数を宣言すると、それを secondViewController に渡すことができます。

しかし、条件内で let jsonData を宣言していて、送信できません。グローバルでjsonのすべての詳細を取得して、secondViewControllerで共有しようとしました。しかし、条件内でしか取得できないため、できません。

let jsonData:NSDictionary = NSJSONSerialization.JSONObjectWithData(urlData!, options:NSJSONReadingOptions.MutableContainers , error: &error) as NSDictionary
                let jsonArray: AnyObject! = jsonData.valueForKey("user")
                NSLog("jsonddata = \(jsonArray)")


 if (segue.identifier == "login_success") {
var svc = segue.destinationViewController as welcomeViewController;
    svc.userNameText =  userNameText.text
    svc.jsonArray = jsonArray
4

1 に答える 1