当我运行我的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
我知道这与我在故事板中将按钮与控制器连接的方式有关,但我在创建具有多个视图的应用程序方面是新的,我不知道如何修复它 这是按钮运行的代码:
@IBAction func playButotonPressed(sender: UIButton) {
let carViewController = storyboard!.instantiateViewControllerWithIdentifier("GameViewController") as! GameViewController
}
答案 0 :(得分:1)
您是否阅读了整个错误消息?我将从下面一行的结尾开始。
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”的视图控制器。
早期的按钮约束记录是一个单独的问题,与故事板的实际问题无关。