)我得到此錯誤後更新到Swift2不知道我缺少什麼。這是我的代碼:錯誤發生在任何已VAR警報= UIAlertController任何幫助表示讚賞無法爲類型'UIAlertController'使用參數列表類型'(標題:字符串,消息:
感謝
// Validate the text fields
if username!.characters.count < 5 {
var alert = UIAlertController(title: "Invalid", message: "Username must be greater than 5 characters", delegate: self, cancelButtonTitle: "OK")
alert.show()
} else if password!.characters.count < 8 {
var alert = UIAlertController(title: "Invalid", message: "Password must be greater than 8 characters", delegate: self, cancelButtonTitle: "OK")
alert.show()
} else if email!.characters.count < 8 {
var alert = UIAlertController(title: "Invalid", message: "Please enter a valid email address", delegate: self, cancelButtonTitle: "OK")
alert.show()
} else {
// Run a spinner to show a task in progress
var spinner: UIActivityIndicatorView = UIActivityIndicatorView(frame: CGRectMake(0, 0, 150, 150)) as UIActivityIndicatorView
spinner.startAnimating()
var newUser = PFUser()
newUser.username = username
newUser.password = password
newUser.email = finalEmail
// Sign up the user asynchronously
newUser.signUpInBackgroundWithBlock({ (succeed, error) -> Void in
// Stop the spinner
spinner.stopAnimating()
if ((error) != nil) {
var alert = UIAlertController(title: "Error", message: "\(error)", delegate: self, cancelButtonTitle: "OK")
alert.show()
} else {
var alert = UIAlertController(title: "Success", message: "Signed Up", delegate: self, cancelButtonTitle: "OK")
alert.show()
dispatch_async(dispatch_get_main_queue(), {() -> Void in
let viewController:UIViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("Home")
self.presentViewController(viewController, animated: true, completion: nil)
})
}
})
}
}
不使用所有這些標籤。它或者與xcode或者語言相關,很少都是。它也僅僅是語言的一個版本,不是全部。 –