ios - libc++abi.dylib : terminating with uncaught exception of type NSException in a game

标签 ios iphone swift storyboard

当我运行我的 Swift 游戏并按下按钮转到另一个屏幕时,我收到此错误:

2015-08-30 04:14:48.038 SHE. 1.0[45317:3481211] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSLayoutConstraint:0x7fe958e50500 H:[UIButton:0x7fe958e4de70'Button']-(8)-[UIButton:0x7fe958e4c2d0'Play']>",
    "<NSLayoutConstraint:0x7fe958e50550 H:[UIButton:0x7fe958e4de70'Button']-(73)-[UIButton:0x7fe958e4c2d0'Play']>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fe958e50550 H:[UIButton:0x7fe958e4de70'Button']-(73)-[UIButton:0x7fe958e4c2d0'Play']>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2015-08-30 04:14:48.040 SHE. 1.0[45317:3481211] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSLayoutConstraint:0x7fe958e505a0 H:[UIButton:0x7fe958e4c2d0'Play']-(8)-[UIButton:0x7fe958e4eac0'Button']>",
    "<NSLayoutConstraint:0x7fe958e505f0 H:[UIButton:0x7fe958e4c2d0'Play']-(73)-[UIButton:0x7fe958e4eac0'Button']>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fe958e505f0 H:[UIButton:0x7fe958e4c2d0'Play']-(73)-[UIButton:0x7fe958e4eac0'Button']>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2015-08-30 04:14:49.304 SHE. 1.0[45317:3481211] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard (<UIStoryboard: 0x7fe958e45b80>) doesn't contain a view controller with identifier 'GameViewController''
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010e475c65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000110194bb7 objc_exception_throw + 45
    2   UIKit                               0x000000010f402a66 -[UIStoryboard instantiateInitialViewController] + 0
    3   SHE. 1.0                            0x000000010ded1422 _TFC8SHE__1_08MainMenu18playButotonPressedfS0_FCSo8UIButtonT_ + 226
    4   SHE. 1.0                            0x000000010ded153a _TToFC8SHE__1_08MainMenu18playButotonPressedfS0_FCSo8UIButtonT_ + 58
    5   UIKit                               0x000000010eec9d62 -[UIApplication sendAction:to:from:forEvent:] + 75
    6   UIKit                               0x000000010efdb50a -[UIControl _sendActionsForEvents:withEvent:] + 467
    7   UIKit                               0x000000010efda8d9 -[UIControl touchesEnded:withEvent:] + 522
    8   UIKit                               0x000000010ef16958 -[UIWindow _sendTouchesForEvent:] + 735
    9   UIKit                               0x000000010ef17282 -[UIWindow sendEvent:] + 682
    10  UIKit                               0x000000010eedd541 -[UIApplication sendEvent:] + 246
    11  UIKit                               0x000000010eeeacdc _UIApplicationHandleEventFromQueueEvent + 18265
    12  UIKit                               0x000000010eec559c _UIApplicationHandleEventQueue + 2066
    13  CoreFoundation                      0x000000010e3a9431 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    14  CoreFoundation                      0x000000010e39f2fd __CFRunLoopDoSources0 + 269
    15  CoreFoundation                      0x000000010e39e934 __CFRunLoopRun + 868
    16  CoreFoundation                      0x000000010e39e366 CFRunLoopRunSpecific + 470
    17  GraphicsServices                    0x00000001125aaa3e GSEventRunModal + 161
    18  UIKit                               0x000000010eec88c0 UIApplicationMain + 1282
    19  SHE. 1.0                            0x000000010deefef7 main + 135
    20  libdyld.dylib                       0x00000001108fa145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

我知道这与我在 Storyboard 中将按钮与 Controller 连接的方式有关,但我是制作具有多个 View 的应用程序的新手,我不知道如何修复它 这是按钮运行的代码:

@IBAction func playButotonPressed(sender: UIButton) {
    let carViewController = storyboard!.instantiateViewControllerWithIdentifier("GameViewController") as! GameViewController
}

最佳答案

您是否阅读了整个错误消息?我将从下面一行的末尾开始。

2015-08-30 04:14:49.304 SHE. 1.0[45317:3481211] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard (<UIStoryboard: 0x7fe958e45b80>) doesn't contain a view controller with identifier 'GameViewController''

UIStoryboard 不包含标识符为“GameViewController”的 View Controller 。

早期的按钮约束记录是一个单独的问题,与 Storyboard的实际问题无关。

关于ios - libc++abi.dylib : terminating with uncaught exception of type NSException in a game,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32292586/

相关文章:

ios - 推送通知 : both didFailToRegister and didRegister delegate not calling

iphone - 检测 iOS 5 上的铃声(静音按钮)位置?

iphone - 在 Objective C 中读取 .doc (MS Word) 文件?

ios - 如何检测 UIPickerView 的变化?

android - Android RelativeLayout/LinearLayout 的 iOS 等价物是什么?

ios - 切换到 Xcode 8 并转换为免费(非付费)开发者帐户后,无法再构建到设备

ios - iOS 错误 "request for rect of invalid section"是什么意思?

iphone - 我可以让模拟器慢动作旋转吗?

objective-c - 将 0 作为枚举选项传递给 Swift 中的 Objective C 函数

ios - 如何将图像从 AWS S3 加载到 UICollectionView 中?