1

我刚刚更新到 Xcode 6.3,我必须更新我的代码才能使用 Swift 1.2。看起来我的所有代码都是最新的,但是,当涉及到UIAlertAction's 时,我的编译器会感到困惑。

在此处输入图像描述

var passwordAlert = UIAlertController (title: "Change Password", message: "For security reasons, you can not change your password through the app. We will send an email to " + currentEmail + ". Click 'Send' to continue.", preferredStyle: UIAlertControllerStyle.Alert)

        let standardCancel = UIAlertAction (title: "Dismiss", style: .Cancel, handler: nil)

        let actionSubmit = UIAlertAction (title: "Send", style: UIAlertActionStyle.Default) { (UIAlertAction: action) -> Void in

            PFUser.requestPasswordResetForEmailInBackground(self.currentEmail){
                (success: Bool!, error: NSError!) -> Void in

                if (success == true) {

                    let emailAlert = UIAlertController (title: "Password", message: "An email containing information on how to change your password has been sent to " + self.currentEmail + ". You should receive it from Parse.com within 10 minutes", preferredStyle: UIAlertControllerStyle.Alert)

                    emailAlert.addAction(standardCancel)

                    self.presentViewController(emailAlert, animated: true, completion: nil)
                }

                else {

                    let errorAlert = UIAlertController (title: "Error", message: "There was an error while processing your request. This may be because the email is invalid or the app could not connect to the internet. Please try again.", preferredStyle: UIAlertControllerStyle.Alert)

                    errorAlert.addAction(standardCancel)

                    self.presentViewController(errorAlert, animated: true, completion: nil)
                }
            }
        }

        let actionCancel = UIAlertAction (title: "Cancel", style: .Cancel, handler: nil)

        passwordAlert.addAction(actionSubmit)
        passwordAlert.addAction(actionCancel)

        self.presentViewController(passwordAlert, animated: true, completion: nil)

有任何想法吗?

4

0 回答 0