【发布时间】:2015-12-02 04:24:56
【问题描述】:
我有 2 个 ViewController,比如说 Feed 和 Login。初始页面是 Feed,如果未通过身份验证,用户将被定向到登录页面。填写表格后,成功登录后,我正试图回到 Feed 页面。
在 FeedVC 中,我添加了:
@IBAction func unwindToFeed(segue: UIStoryboardSegue){
}
在 LoginVC 中,在登录按钮上按下
@IBAction func loginButton(sender: AnyObject) {
func authenticatedUser (...) {
if error != nil {
// error handling
} else {
// success
NSOperationQueue.mainQueue().addOperationWithBlock({
self.performSegueWithIdentifier("unwindToFeed", sender: self)
})
}
}
}
但是,在成功时,它并没有展开,而且我得到一个错误
由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,> 原因:“接收器 (0x7fd789a2cab0>) 与标识符“unwindToFeed”没有任何关联”
在 Storyboard 中,在 LoginVC 中,我还尝试按 ctrl+从黄色 (ViewController) 拖动到顶部的退出。但是,一旦我这样做了,我就会收到"Segues initiated directly from view controllers must have an identifier",并在登录视图控制器场景中显示Unwind segue to 'Exit'。
我做错了什么?
【问题讨论】: