无论条件如何,我的 iOS Swift 应用程序都在执行 Segue
My iOS Swift App is Performing a Segue Regardless of Conditionals
我正在使用 Parse 创建一个应用程序。该应用程序的流程很简单:用户注册,如果注册成功,则执行 segue。如果不是,请不要执行 segue。问题是,无论我的条件如何,segue 都会发生。这是下面的代码。
user.signUpInBackgroundWithBlock {
(succeeded: Bool!, signupError: NSError!) -> Void in
if signupError == nil {
// Hooray! Let them use the app now!
println("Signed Up!")
self.performSegueWithIdentifier("mySegue", sender: self)
} else {
let errorString = signupError.userInfo?["error"] as? NSString
// Show the errorString somewhere and let the user try again.
println(errorString)
}
}
这是直接来自 Parse 文档的代码。我还检查了查看 succeeded != false
是否也有效。不是,哈哈
你确定你没有在情节提要中添加一个 segue,如果你按下 UIButton
就会调用它吗?
因为如果是这种情况,您需要将其删除,并且需要进行 ViewController
到 ViewController
转场。 (不是 UIButton
到 ViewController 转场)。
我正在使用 Parse 创建一个应用程序。该应用程序的流程很简单:用户注册,如果注册成功,则执行 segue。如果不是,请不要执行 segue。问题是,无论我的条件如何,segue 都会发生。这是下面的代码。
user.signUpInBackgroundWithBlock {
(succeeded: Bool!, signupError: NSError!) -> Void in
if signupError == nil {
// Hooray! Let them use the app now!
println("Signed Up!")
self.performSegueWithIdentifier("mySegue", sender: self)
} else {
let errorString = signupError.userInfo?["error"] as? NSString
// Show the errorString somewhere and let the user try again.
println(errorString)
}
}
这是直接来自 Parse 文档的代码。我还检查了查看 succeeded != false
是否也有效。不是,哈哈
你确定你没有在情节提要中添加一个 segue,如果你按下 UIButton
就会调用它吗?
因为如果是这种情况,您需要将其删除,并且需要进行 ViewController
到 ViewController
转场。 (不是 UIButton
到 ViewController 转场)。