2017-04-04 7 views
1

サインアップ後、アラートコントローラがポップアップしてからloginFirstViewControllerに移動する必要がありますが、これは起こりません。それだけであなたは、直接あなたがuialertactionのために完了ハンドラを追加する必要があり、これを防ぐために、新しいのViewControllerを開いた警告コントローラUIAlertViewcontrollerがviewcontrollerに行く前にポップされていません

 if error == nil { 



       FIRAuth.auth()?.currentUser!.sendEmailVerification(completion: { (error) in 
       }) 



       print("You have successfully signed up") 
       //Goes to the Setup page which lets the user take a photo for their profile picture and also chose a username 




       let alertController = UIAlertController(title: "Successful!", message: "Email Verification link sent", preferredStyle: .alert) 


       let alertActionOkay = UIAlertAction(title: "Okay", style: .default) 

        let vc = self.storyboard?.instantiateViewController(withIdentifier: "LoginFirstViewController") 

        self.present(vc!, animated: true, completion: nil) 



        alertController.addAction(alertActionOkay) 

       self.present(alertController, animated: true, completion: nil) 

       } 
+0

を開くことができたとき、あなたは、ユーザーが[OK]ボタンをクリックすると、別のVCにnavigetしたいか、あなたはViewControllerをする前のViewControllerにalertControllerを提示している他の –

+1

提示されています。アラートプッシュの新しい操作のokayアクションで、以前のコントローラーにアラートを表示してみることができます。 –

答えて

3

をpopingのではなく、loginfirstviewcontrollerに進みます。ユーザーのOKボタンを押しますが、あなたが他のViewControllerに

let alertController = UIAlertController(title: "Successful!", message: "Email Verification link sent", preferredStyle: .alert) 
    let alertActionOkay = UIAlertAction(title: "Okay", style: .default) { (action) in 
     let vc = self.storyboard?.instantiateViewController(withIdentifier: "LoginFirstViewController") 
     self.present(vc!, animated: true, completion: nil) 
    } 
    alertController.addAction(alertActionOkay) 
    self.present(alertController, animated: true, completion: nil) 
+0

よかったよ –

関連する問題