xCode 6.1.1线程1:EXC_BREAKPOINT(代码= EXC_I386_BPT,子代码= 0x0)

时间:2015-02-17 12:48:02

标签: ios xcode swift

使用xCode 6.1.1运行应用程序时遇到问题。简而言之,应用程序登录到Facebook并且必须显示另一个视图。在控制台中,我唯一看到的是“(lldb)”,接下来就是堆栈跟踪。

* thread #1: tid = 0xae9d1, 0x000000010a4158ad libswiftCore.dylib`swift_dynamicCastClassUnconditional + 77, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
  * frame #0: 0x000000010a4158ad libswiftCore.dylib`swift_dynamicCastClassUnconditional + 77
    frame #1: 0x000000010802867a ciao`ciao.ViewController.prepareForSegue (segue=0x00007f9271c653a0, sender=Some, self=0x00007f9271d87110)(ObjectiveC.UIStoryboardSegue, sender : Swift.Optional<Swift.AnyObject>) -> () + 890 at ViewController.swift:47
    frame #2: 0x000000010802894b ciao`@objc ciao.ViewController.prepareForSegue (ciao.ViewController)(ObjectiveC.UIStoryboardSegue, sender : Swift.Optional<Swift.AnyObject>) -> () + 75 at ViewController.swift:0
    frame #3: 0x000000010931e71c UIKit`-[UIStoryboardSegueTemplate _perform:] + 151
    frame #4: 0x000000010802a5de ciao`ciao.ViewController.(connection=Some, user=Some, error=None, self=0x00007f9271d87110) -> (Swift.ImplicitlyUnwrappedOptional<ObjectiveC.FBLoginView>, user : ObjectiveC.FBGraphUser) -> ()).(closure #1) + 1534 at ViewController.swift:39
    frame #5: 0x000000010802aa4a ciao`reabstraction thunk helper from @callee_owned (@owned Swift.ImplicitlyUnwrappedOptional<ObjectiveC.FBRequestConnection>, @owned Swift.ImplicitlyUnwrappedOptional<Swift.AnyObject>, @owned Swift.ImplicitlyUnwrappedOptional<ObjectiveC.NSError>) -> (@unowned ()) to @callee_unowned @objc_block (@unowned Swift.ImplicitlyUnwrappedOptional<ObjectiveC.FBRequestConnection>, @unowned Swift.ImplicitlyUnwrappedOptional<Swift.AnyObject>, @unowned Swift.ImplicitlyUnwrappedOptional<ObjectiveC.NSError>) -> (@unowned ()) + 90 at ViewController.swift:37
    frame #6: 0x0000000108032944 ciao`__51-[FBRequestConnection completeWithResults:orError:]_block_invoke657(.block_descriptor=0x00007f9271c63250, task=<unavailable>) + 65 at FBRequestConnection.m:1400
    frame #7: 0x000000010804b749 ciao`__39-[FBTask dependentTaskWithBlock:queue:]_block_invoke_2(.block_descriptor=0x00007f9271c63390) + 30 at FBTask.m:257
    frame #8: 0x000000010a80bba6 libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame #9: 0x000000010a8297f4 libdispatch.dylib`_dispatch_client_callout + 8
    frame #10: 0x000000010a8128fb libdispatch.dylib`_dispatch_main_queue_callback_4CF + 949
    frame #11: 0x0000000108265fe9 CoreFoundation`__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    frame #12: 0x0000000108228eeb CoreFoundation`__CFRunLoopRun + 2043
    frame #13: 0x0000000108228486 CoreFoundation`CFRunLoopRunSpecific + 470
    frame #14: 0x000000010d3269f0 GraphicsServices`GSEventRunModal + 161
    frame #15: 0x0000000108dcc420 UIKit`UIApplicationMain + 1282
    frame #16: 0x000000010802bcae ciao`top_level_code + 78 at AppDelegate.swift:12
    frame #17: 0x000000010802bcea ciao`main + 42 at AppDelegate.swift:0
    frame #18: 0x000000010a85e145 libdyld.dylib`start + 1

有人有建议吗?

这是prepareForSegue函数:

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

        if (segue.identifier=="showView"){
            var vc:NewViewController = segue.destinationViewController as NewViewController
            vc.firstName=self.firstName
            vc.lastName=self.lastName
            vc.email=self.email
        }

    }

1 个答案:

答案 0 :(得分:0)

导航控制器中是否嵌入了NewViewController

那么也许你可以试试这个:

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

    if (segue.identifier=="showView"){
       let navigationController = segue.destinationViewController as UINavigationController 
let vc = navigationController.topViewController as NewViewController
        vc.firstName=self.firstName
        vc.lastName=self.lastName
        vc.email=self.email
    }
}

其他潜在的罪魁祸首包括segue标识符,尽管这可能会产生更有用的错误消息。

执行@PhilipMills建议并在运行时检查实际目标控制器是什么。