【问题标题】:segue with timer causing signal sigbart与定时器转接导致信号 sigabrt
【发布时间】:2015-07-31 19:20:11
【问题描述】:
let timer = NSTimer.scheduledTimerWithTimeInterval(8.0, target: self, selector: "timeToMoveOn", userInfo: nil, repeats: false)




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

导致:

libc++abi.dylib:以未捕获的类型异常终止 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) 

【问题讨论】:

  • 能否在问题中添加错误日志?
  • 我添加了错误日志

标签: swift timer segue


【解决方案1】:

你没有为你的 segue 分配一个标识符。

首先点击你想在你的故事板中执行的segue,然后转到右侧的属性检查器,然后为其添加一个标识符,如下图所示:

之后就可以正常使用了。

【讨论】:

  • 喜欢发给你还是什么?
  • 有没有我只能寄给你?我不想公开发布它
猜你喜欢
  • 2017-05-10
  • 1970-01-01
  • 2016-01-05
  • 1970-01-01
  • 2014-04-29
  • 2014-12-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多