fiberly
(Fiberly)
1
Hey swift forums, I’m having trouble launching a completed Rock Paper Scissors game. This is lesson 20 from the introduction to app development with swift iBook. I receive a SIGABRT ERROR, building the app succeeds but then I receive a white screen. Any help at all would be greatly appreciated. Thank you.
DEBUG AREA:
2019-06-23 20:11:20.811780-0400 Rock Paper Scissors[5220:106660] [general] CFLocaleCopyCurrent() failed to look up current locale via 'AppleLocale' and 'AppleLanguages' in user preferences; falling back to locale identifier 'en_US' as the default. Consider checking Console for sandbox violations from this process for reading from preferences, or enabling CoreFoundation debug logging for more information. This will only be logged once.
2019-06-23 20:11:20.984376-0400 Rock Paper Scissors[5220:106523] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Rock_Paper_Scissors.ViewController 0x7fd609f048a0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key bump.'
*** First throw call stack:
(
0 CoreFoundation 0x00000001094f8b6e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x0000000107d3ff57 objc_exception_throw + 48
2 CoreFoundation 0x00000001094f8739 -[NSException raise] + 9
3 Foundation 0x000000010779afc0 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 325
4 UIKitCore 0x0000000115a241f5 -[UIViewController setValue:forKey:] + 87
5 UIKitCore 0x0000000115d02e12 -[UIRuntimeOutletConnection connect] + 109
6 CoreFoundation 0x00000001094e5022 -[NSArray makeObjectsPerformSelector:] + 242
7 UIKitCore 0x0000000115cfffba -[UINib instantiateWithOwner:options:] + 2190
8 UIKitCore 0x0000000115a2b219 -[UIViewController _loadViewFromNibNamed:bundle:] + 395
9 UIKitCore 0x0000000115a2bd25 -[UIViewController loadView] + 177
10 UIKitCore 0x0000000115a2c024 -[UIViewController loadViewIfRequired] + 172
11 UIKitCore 0x0000000115a2c7d1 -[UIViewController view] + 27
12 UIKitCore 0x00000001160be844 -[UIWindow addRootViewControllerViewIfPossible] + 150
13 UIKitCore 0x00000001160bef93 -[UIWindow _setHidden:forced:] + 325
14 UIKitCore 0x00000001160d1882 -[UIWindow _mainQueue_makeKeyAndVisible] + 42
15 UIKitCore 0x00000001160802e8 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 4199
16 UIKitCore 0x00000001160858ae -[UIApplication _runWithMainScene:transitionContext:completion:] + 1286
17 UIKitCore 0x00000001157f2e8c -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122
18 UIKitCore 0x0000000115cbf8a0 _UIScenePerformActionsWithLifecycleActionMask + 78
19 UIKitCore 0x00000001157f3993 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198
20 UIKitCore 0x00000001157f345f -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 474
21 UIKitCore 0x00000001157f37c3 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 810
22 UIKitCore 0x00000001157f3060 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 345
23 UIKitCore 0x00000001157f73ca __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke_2 + 159
24 UIKitCore 0x0000000115bea08e +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 845
25 UIKitCore 0x0000000115cdd65c _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 240
26 UIKitCore 0x00000001157f7009 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 171
27 UIKitCore 0x0000000115cdd55f _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 84
28 UIKitCore 0x00000001157f6e68 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 359
29 UIKitCore 0x00000001156659b7 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 657
30 UIKitCore 0x0000000115664930 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 374
31 UIKitCore 0x00000001156656e1 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 210
32 UIKitCore 0x0000000116084126 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 535
33 UIKitCore 0x0000000115c0a77d -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
34 FrontBoardServices 0x0000000111611b69 -[FBSSceneImpl _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 442
35 FrontBoardServices 0x000000011163a168 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke.160 + 102
36 FrontBoardServices 0x000000011161ca99 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 220
37 FrontBoardServices 0x0000000111639df9 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke + 355
38 libdispatch.dylib 0x000000010a300ed0 _dispatch_client_callout + 8
39 libdispatch.dylib 0x000000010a303e41 _dispatch_block_invoke_direct + 300
40 FrontBoardServices 0x000000011166122b __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
41 FrontBoardServices 0x0000000111660f12 -[FBSSerialQueue _performNext] + 436
42 FrontBoardServices 0x0000000111661433 -[FBSSerialQueue _performNextFromRunLoopSource] + 33
43 CoreFoundation 0x000000010945c371 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
44 CoreFoundation 0x000000010945c301 __CFRunLoopDoSource0 + 81
45 CoreFoundation 0x000000010945bad4 __CFRunLoopDoSources0 + 180
46 CoreFoundation 0x00000001094567ef __CFRunLoopRun + 1263
47 CoreFoundation 0x0000000109455fd6 CFRunLoopRunSpecific + 438
48 GraphicsServices 0x0000000110e659f8 GSEventRunModal + 65
49 UIKitCore 0x0000000116087722 UIApplicationMain + 1621
50 Rock Paper Scissors 0x0000000107413a7b main + 75
51 libdyld.dylib 0x000000010a3896ad start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Jon_Shier
(Jon Shier)
2
You're missing an @IBOutlet connection to a variable named bump. That's usually the cause of UIViewController classes crashed with the exception about not being "key value coding-compliant".
1 Like
fiberly
(Fiberly)
7
I fixed all of the connections and am still receiving an error, help is greatly appreciated.
DEBUG AREA:
2019-06-23 22:33:13.595787-0400 Rock Paper Scissors[7360:166148] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<Rock_Paper_Scissors.ViewController 0x7fc006609790> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key buttons.'
Lantua
8
I’d be much nicer if you put the debugging statements inside triple tick marks, like this
```
Put code here
```
Also you can make use of the edit button, so you don't nee to delete comment every time you want to change something.
fiberly
(Fiberly)
9
Thank you, this is good to know.
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var sign: UILabel!
@IBOutlet weak var status: UILabel!
@IBOutlet weak var scissors: UIButton!
@IBOutlet weak var rock: UIButton!
@IBOutlet weak var paper: UIButton!
@IBOutlet weak var playAgain: UIButton!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
resetView()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func resetView() {
sign.text = "🤖"
status.text = "Rock, Paper, Scissors?"
rock.isHidden = false
rock.isEnabled = true
paper.isHidden = false
paper.isEnabled = true
scissors.isHidden = false
scissors.isEnabled = true
playAgain.isHidden = true
}
func play(_ playerTurn: Sign) {
rock.isEnabled = false
paper.isEnabled = false
scissors.isEnabled = false
let opponent = randomSign()
sign.text = opponent.emoji
let gameState = playerTurn.turns(opponent)
switch gameState {
case .draw:
status.text = "It's a tie!"
case .lose:
status.text = "Sorry, you lost..."
case .win:
status.text = "Congratulations, you won!"
case .start:
status.text = "Rock, Paper, Scissors?"
}
switch playerTurn {
case .rock:
rock.isHidden = false
paper.isHidden = true
scissors.isHidden = true
case .paper:
rock.isHidden = true
paper.isHidden = false
scissors.isHidden = true
case .scissors:
rock.isHidden = true
paper.isHidden = true
scissors.isHidden = false
}
playAgain.isHidden = false
}
@IBAction func scissorsSelect(_ sender: Any) {
play(Sign.scissors)
}
@IBAction func rockSelect(_ sender: Any) {
play(Sign.rock)
}
@IBAction func paperSelect(_ sender: Any) {
play(Sign.paper)
}
@IBAction func playAgainSelect(_ sender: Any) {
resetView()
}
}
Lantua
10
It's still much of the same error. The story board tries to set a value for variable named button in your ViewController, but it couldn't.
- If your
ViewController indeed has variable buttons, you might want to check that it's proper @IBObject.
- If your
ViewController doesn't have buttons, then storyboard incorrectly think that it does. You might want to go in and fix it in storyboard.
fiberly
(Fiberly)
11
Thanks this sort of helped, regardless problem solved. Thanks
1 Like