我收到错误
2014-04-09 01:42:23.599 appname[9584:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<LoginViewController: 0x9a9cda0>) has no segue with identifier 'login''
*** First throw call stack:
(
0 CoreFoundation 0x0263c1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x023bb8e5 objc_exception_throw + 44
2 UIKit 0x0119c48c -[UIViewController shouldPerformSegueWithIdentifier:sender:] + 0
3 appname 0x00002fea -[LoginViewController viewDidAppear:] + 170
4 UIKit 0x0119e099 -[UIViewController _setViewAppearState:isAnimating:] + 526
5 UIKit 0x0119e617 -[UIViewController __viewDidAppear:] + 146
6 UIKit 0x011a0014 __64-[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:]_block_invoke + 44
7 UIKit 0x0119e9aa -[UIViewController _executeAfterAppearanceBlock] + 63
8 UIKit 0x010990d0 ___afterCACommitHandler_block_invoke_2 + 33
9 UIKit 0x01099055 _applyBlockToCFArrayCopiedToStack + 403
10 UIKit 0x01098e9a _afterCACommitHandler + 568
11 CoreFoundation 0x0260436e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
12 CoreFoundation 0x026042bf __CFRunLoopDoObservers + 399
13 CoreFoundation 0x025e2254 __CFRunLoopRun + 1076
14 CoreFoundation 0x025e19d3 CFRunLoopRunSpecific + 467
15 CoreFoundation 0x025e17eb CFRunLoopRunInMode + 123
16 GraphicsServices 0x042205ee GSEventRunModal + 192
17 GraphicsServices 0x0422042b GSEventRun + 104
18 UIKit 0x0107bf9b UIApplicationMain + 1225
19 appname 0x00004e3d main + 141
20 libdyld.dylib 0x02ed9701 start + 1
21 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
但是,我认为我的代码没有出错,这是我的观点。我错过了什么以便创建这种错误?
- (void)viewDidAppear:(BOOL)animated {
PFUser *user = [PFUser currentUser];
if (user.username != nil) {
[self performSegueWithIdentifier:@"login" sender:self];
}
}
答案 0 :(得分:0)
好像你没有在故事板中设置segue的名字。下图是我的一个segue的名称,对于你来说,文本框只包含登录。
当您忘记在导航控制器中“嵌入”故事板时,也会发生这种情况:
答案 1 :(得分:0)
错误告诉你的是,虽然你的故事板可能包含一个名为@"login"
的segue,但它不会从这个LoginViewController 发出目前是self
)。
你可能认为它确实如此,但相信我,运行时比你知道的更多。