segue with timer causing signal sigbart

时间:2015-07-31 19:20:11

标签: swift timer segue

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




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

are causing :

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

error log:

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) 

1 个答案:

答案 0 :(得分:1)

You are missing to assign an identifier to your segue.

First of all click on the segue which you want to perform in your storyBoard after that go to Attribute inspector at the right side then add an identifier to it as shown in below image:

enter image description here

After that it will work fine.