質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Swift

Swiftは、アップルのiOSおよびOS Xのためのプログラミング言語で、Objective-CやObjective-C++と共存することが意図されています

Q&A

解決済

1回答

663閲覧

swiftの質問です。また前と同じようなエラーが出てしまいました。

jay_yoshizawa

総合スコア12

Swift

Swiftは、アップルのiOSおよびOS Xのためのプログラミング言語で、Objective-CやObjective-C++と共存することが意図されています

0グッド

0クリップ

投稿2019/12/30 06:21

2019-12-30 15:16:49.041528+0900 no stress life[43527:2462708] Unknown class _TtC14no_stress_life19FirstViewController in Interface Builder file. 2019-12-30 15:16:49.079460+0900 no stress life[43527:2462708] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7fd9ed508960> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key label1.' *** First throw call stack: ( 0 CoreFoundation 0x00000001047cc8db __exceptionPreprocess + 331 1 libobjc.A.dylib 0x0000000103d6fac5 objc_exception_throw + 48 2 CoreFoundation 0x00000001047cc449 -[NSException raise] + 9 3 Foundation 0x00000001037e43a6 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 289 4 UIKitCore 0x0000000107ab6f8e -[UIViewController setValue:forKey:] + 87 5 UIKitCore 0x0000000107d44cd9 -[UIRuntimeOutletConnection connect] + 109 6 CoreFoundation 0x00000001047b8f21 -[NSArray makeObjectsPerformSelector:] + 305 7 UIKitCore 0x0000000107d41a1f -[UINib instantiateWithOwner:options:] + 1810 8 UIKitCore 0x0000000107abe06b -[UIViewController _loadViewFromNibNamed:bundle:] + 382 9 UIKitCore 0x0000000107abe9f5 -[UIViewController loadView] + 177 10 UIKitCore 0x0000000107abed04 -[UIViewController loadViewIfRequired] + 172 11 UIKitCore 0x0000000107abf524 -[UIViewController view] + 27 12 UIKitCore 0x00000001080f822b -[UIWindow addRootViewControllerViewIfPossible] + 122 13 UIKitCore 0x00000001080f891f -[UIWindow _setHidden:forced:] + 289 14 UIKitCore 0x000000010810b57e -[UIWindow makeKeyAndVisible] + 42 15 UIKitCore 0x00000001080bb33c -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4555 16 UIKitCore 0x00000001080c04e6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1617 17 UIKitCore 0x0000000107904a4e __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 904 18 UIKitCore 0x000000010790d346 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153 19 UIKitCore 0x0000000107904664 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236 20 UIKitCore 0x0000000107904fc0 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1091 21 UIKitCore 0x0000000107903332 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 782 22 UIKitCore 0x0000000107902fe9 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433 23 UIKitCore 0x0000000107907d2e __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 576 24 UIKitCore 0x0000000107908988 _performActionsWithDelayForTransitionContext + 100 25 UIKitCore 0x0000000107907a95 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223 26 UIKitCore 0x000000010790ca48 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392 27 UIKitCore 0x00000001080bedc8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 514 28 UIKitCore 0x0000000107c7602f -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361 29 FrontBoardServices 0x0000000110993d25 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448 30 FrontBoardServices 0x000000011099dad6 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 283 31 FrontBoardServices 0x000000011099d300 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53 32 libdispatch.dylib 0x0000000106bc0db5 _dispatch_client_callout + 8 33 libdispatch.dylib 0x0000000106bc42ba _dispatch_block_invoke_direct + 300 34 FrontBoardServices 0x00000001109cf0da __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30 35 FrontBoardServices 0x00000001109ced92 -[FBSSerialQueue _performNext] + 451 36 FrontBoardServices 0x00000001109cf327 -[FBSSerialQueue _performNextFromRunLoopSource] + 42 37 CoreFoundation 0x0000000104733db1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 38 CoreFoundation 0x0000000104733633 __CFRunLoopDoSources0 + 243 39 CoreFoundation 0x000000010472dcef __CFRunLoopRun + 1231 40 CoreFoundation 0x000000010472d4d2 CFRunLoopRunSpecific + 626 41 GraphicsServices 0x000000010d8ef2fe GSEventRunModal + 65 42 UIKitCore 0x00000001080c1fc2 UIApplicationMain + 140 43 no stress life 0x0000000103488a4b main + 75 44 libdyld.dylib 0x0000000106c35541 start + 1 45 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException

このようなコードがまた出てしまいした。
ただ、labelを右クリックしてアクションみたなのを消すと直りますが、いつまでたってもコネクションができず困っております。
この上のコードから何か原因の真相を教えて欲しいです。
教えていただければ、幸いです。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

エラーメッセージに
Unknown class _TtC14no_stress_life19FirstViewController in Interface Builder file.
'[<UIViewController 0x7fd9ed508960> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key label1.'
の2つが出ていることから、問題の根本原因はlabel1の接続ではなく、Storyboardのclass欄に正しく「FirstViewController」が設定されてなくて、label1をFirstViewControllerでなく
誤ってUIViewControllerに接続しようとしてしまったのだろうと思います。

次のような記事を参考にしてclass欄を設定し直してみて下さい。
http://programming-beginner-memo.com/?p=223

投稿2020/01/02 05:38

TakeOne

総合スコア6299

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問