'스위프트 개발 버그 찾기'에 해당되는 글 1건

  1. 2024.12.27 Swift 오류-this class is not key value coding-compliant for the key btnSize 3

this class is not key value coding-compliant for the key btnSize

책 예제를 따라하거나, 이미 만들어진 ViewController와 mainstory.swift를 합칠 경우,

내부 Widget에 정의한 action에 대해 연결이 깨진 경우가 발생한다.

확인하려면, Xcode에서 Triggered Segues에 링크가 깨져서 노란색으로 경고를 띄워주는 것을 발견할 수 있다. 이것을 다시 만들어서 정의해 주면 된다. 

Swift 오류 확인하는 화면

오류 내용은 아래와 같이 나타난다. 

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x103a17520> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key btnSize.'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001804b910c __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x0000000180092da8 objc_exception_throw + 72
	2   CoreFoundation                      0x00000001804b8ca0 -[NSException init] + 0
	3   Foundation                          0x0000000180e9da3c -[NSObject(NSKeyValueCoding) setValue:forKey:] + 268
	4   UIKitCore                           0x00000001853b7dc4 -[UIViewController setValue:forKey:] + 76
	5   UIKitCore                           0x00000001857435ec -[UIRuntimeOutletConnection connect] + 80
	6   CoreFoundation                      0x00000001804a5cf0 -[NSArray makeObjectsPerformSelector:] + 192
	7   UIKitCore                           0x0000000185736ee4 -[UINib instantiateWithOwner:options:] + 1420
    8   UIKitCore                           0x00000001853bf7a8 -[UIViewController loadView] + 392
	9   UIKitCore                           0x00000001853bfa64 -[UIViewController loadViewIfRequired] + 152
	10  UIKitCore                           0x00000001853c0000 -[UIViewController view] + 20
	11  UIKitCore                           0x00000001852f4628 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 912
	12  UIKitCore                           0x00000001852eef70 -[UITabBarController _setSelectedViewController:performUpdates:] + 352
	13  UIKitCore                           0x00000001852eedd4 -[UITabBarController setSelectedViewController:] + 80
	14  UIKitCore                           0x00000001852f3a98 -[UITabBarController _setSelectedViewControllerAndNotify:] + 216
	15  UIKitCore                           0x00000001852f3964 -[UITabBarController _tabBarItemClicked:] + 160
	16  UIKitCore                           0x0000000185b36e3c -[UIApplication sendAction:to:from:forEvent:] + 96
	17  UIKitCore                           0x00000001850f969c -[UITabBar _sendAction:withEvent:] + 380
	18  UIKitCore                           0x0000000185b36e3c -[UIApplication sendAction:to:from:forEvent:] + 96
	19  UIKitCore                           0x000000018540c830 -[UIControl sendAction:to:forEvent:] + 108
	20  UIKitCore                           0x000000018540cb74 -[UIControl _sendActionsForEvents:withEvent:] + 268
	21  UIKitCore                           0x00000001850fbfb0 -[UITabBar _buttonUp:] + 96
	22  UIKitCore                           0x0000000185b36e3c -[UIApplication sendAction:to:from:forEvent:] + 96
	23  UIKitCore                           0x000000018540c830 -[UIControl sendAction:to:forEvent:] + 108
	24  UIKitCore                           0x000000018540cb74 -[UIControl _sendActionsForEvents:withEvent:] + 268
	25  UIKitCore                           0x000000018540b80c -[UIControl touchesEnded:withEvent:] + 392
	26  UIKitCore                           0x0000000185b6aa10 -[UIWindow _sendTouchesForEvent:] + 972
	27  UIKitCore                           0x0000000185b6be20 -[UIWindow sendEvent:] + 2840
	28  UIKitCore                           0x0000000185b4b80c -[UIApplication sendEvent:] + 376
	29  UIKitCore                           0x0000000185bd5c70 __dispatchPreprocessedEventFromEventQueue + 1156
	30  UIKitCore                           0x0000000185bd8c00 __processEventQueue + 5592
	31  UIKitCore                           0x0000000185bd0f10 updateCycleEntry + 156
	32  UIKitCore                           0x00000001850a5cec _UIUpdateSequenceRun + 76
	33  UIKitCore                           0x0000000185a60858 schedulerStepScheduledMainSection + 168
	34  UIKitCore                           0x0000000185a5fc90 runloopSourceCallback + 80
	35  CoreFoundation                      0x000000018041d294 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
	36  CoreFoundation                      0x000000018041d1dc __CFRunLoopDoSource0 + 172
	37  CoreFoundation                      0x000000018041c940 __CFRunLoopDoSources0 + 232
	38  CoreFoundation                      0x0000000180416e84 __CFRunLoopRun + 788
	39  CoreFoundation                      0x00000001804166f4 CFRunLoopRunSpecific + 552
	40  GraphicsServices                    0x00000001905e5b10 GSEventRunModal + 160
	41  UIKitCore                           0x0000000185b319dc -[UIApplication _run] + 796
	42  UIKitCore                           0x0000000185b35bd4 UIApplicationMain + 124
	43  UIKitCore                           0x0000000184f0a334 block_destroy_helper.22 + 9660
	44  Tab.debug.dylib                     0x0000000102f0103c $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 120
	45  Tab.debug.dylib                     0x0000000102f00fb4 $s3Tab11AppDelegateC5$mainyyFZ + 44
	46  Tab.debug.dylib                     0x0000000102f010b8 __debug_main_executable_dylib_entry_point + 28
	47  dyld                                0x0000000102479410 start_sim + 20
	48  ???                                 0x00000001025ca154 0x0 + 4334592340
	49  ???                                 0x9874000000000000 0x0 + 10985405391063482368
)
libc++abi: terminating due to uncaught exception of type NSException
Exception	NSException *	
"[<UIViewController 0x103a17520> setValue:forUndefinedKey:]: 
this class is not key value coding-compliant for the key btnSize."	0x0000600000c9dfe0

 

Posted by 목표를 가지고 달린다
,