gpt4 book ai didi

swift - segue 与计时器导致信号 sigabrt

转载 作者:行者123 更新时间:2023-11-28 07:02:15 25 4
gpt4 key购买 nike

let timer = NSTimer.scheduledTimerWithTimeInterval(8.0, target: self, selector: "timeToMoveOn", userInfo: nil, repeats: false)




func timeToMoveOn() {
self.performSegueWithIdentifier("omar", sender: nil)
}

导致:

libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

错误日志:

2015-07-31 22:22:34.014 Shiltawi[1236:21701] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<Shiltawi.ViewController2: 0x7f96b1ee2fa0>) has no segue with identifier 'omar''
*** First throw call stack:
(
0 CoreFoundation 0x000000010c318c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010e6dbbb7 objc_exception_throw + 45
2 UIKit 0x000000010d542473 -[UIViewController shouldPerformSegueWithIdentifier:sender:] + 0
3 Shiltawi 0x000000010b825198 _TFC8Shiltawi15ViewController212timeToMoveOnfS0_FT_T_ + 232
4 Shiltawi 0x000000010b8251f2 _TToFC8Shiltawi15ViewController212timeToMoveOnfS0_FT_T_ + 34
5 Foundation 0x000000010c995744 __NSFireTimer + 83
6 CoreFoundation 0x000000010c280174 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
7 CoreFoundation 0x000000010c27fd35 __CFRunLoopDoTimer + 1045
8 CoreFoundation 0x000000010c241d3d __CFRunLoopRun + 1901
9 CoreFoundation 0x000000010c241366 CFRunLoopRunSpecific + 470
10 GraphicsServices 0x0000000110243a3e GSEventRunModal + 161
11 UIKit 0x000000010d40f8c0 UIApplicationMain + 1282
12 Shiltawi 0x000000010b8507d7 main + 135
13 libdyld.dylib 0x000000010ee1d145 start + 1
14 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

最佳答案

您缺少为您的 segue 分配标识符。

首先点击你想要在 Storyboard中执行的转场,然后在右侧的属性检查器中添加一个标识符,如下图所示:

enter image description here

之后它会正常工作。

关于swift - segue 与计时器导致信号 sigabrt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31753649/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com