Lined Notebook

'[<__NSDictionary0 0x6000002680b0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key JE.'

by 사슴비행기
2019-09-03 15:02:54.152112+0900 JeungObjc[3121:485815] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<__NSDictionary0 0x6000002680b0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key JE.'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000011086d8db __exceptionPreprocess + 331
	1   libobjc.A.dylib                     0x000000010fe10ac5 objc_exception_throw + 48
	2   CoreFoundation                      0x000000011086d449 -[NSException raise] + 9
	3   Foundation                          0x000000010f8853a6 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 289
	4   JeungObjc                           0x000000010dfeb0f6 -[EasyWKWebViewController viewDidLoad] + 310
	5   UIKitCore                           0x00000001141300f7 -[UIViewController loadViewIfRequired] + 1183
	6   UIKitCore                           0x0000000114130524 -[UIViewController view] + 27
	7   UIKitCore                           0x000000011476922b -[UIWindow addRootViewControllerViewIfPossible] + 122
	8   UIKitCore                           0x000000011476991f -[UIWindow _setHidden:forced:] + 289
	9   UIKitCore                           0x000000011477c57e -[UIWindow makeKeyAndVisible] + 42
	10  UIKitCore                           0x000000011472c33c -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4555
	11  UIKitCore                           0x00000001147314e6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1617
	12  UIKitCore                           0x0000000113f75a4e __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 904
	13  UIKitCore                           0x0000000113f7e346 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
	14  UIKitCore                           0x0000000113f75664 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
	15  UIKitCore                           0x0000000113f75fc0 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1091
	16  UIKitCore                           0x0000000113f74332 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 782
	17  UIKitCore                           0x0000000113f73fe9 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
	18  UIKitCore                           0x0000000113f78d2e __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 576
	19  UIKitCore                           0x0000000113f79988 _performActionsWithDelayForTransitionContext + 100
	20  UIKitCore                           0x0000000113f78a95 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
	21  UIKitCore                           0x0000000113f7da48 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
	22  UIKitCore                           0x000000011472fdc8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 514
	23  UIKitCore                           0x00000001142e702f -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
	24  FrontBoardServices                  0x000000011b47bd25 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
	25  FrontBoardServices                  0x000000011b485ad6 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 283
	26  FrontBoardServices                  0x000000011b485300 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
	27  libdispatch.dylib                   0x0000000111e7fdb5 _dispatch_client_callout + 8
	28  libdispatch.dylib                   0x0000000111e832ba _dispatch_block_invoke_direct + 300
	29  FrontBoardServices                  0x000000011b4b70da __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
	30  FrontBoardServices                  0x000000011b4b6d92 -[FBSSerialQueue _performNext] + 451
	31  FrontBoardServices                  0x000000011b4b7327 -[FBSSerialQueue _performNextFromRunLoopSource] + 42
	32  CoreFoundation                      0x00000001107d4db1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
	33  CoreFoundation                      0x00000001107d4633 __CFRunLoopDoSources0 + 243
	34  CoreFoundation                      0x00000001107cecef __CFRunLoopRun + 1231
	35  CoreFoundation                      0x00000001107ce4d2 CFRunLoopRunSpecific + 626
	36  GraphicsServices                    0x00000001183f12fe GSEventRunModal + 65
	37  UIKitCore                           0x0000000114732fc2 UIApplicationMain + 140
	38  JeungObjc                           0x000000010dfeaa20 main + 112
	39  libdyld.dylib                       0x0000000111ef4541 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

다음과 같은 Error가 발생했다.

대충 보니, NSDictionary에 뭔가.. 문제가 있는 것 같은데 잘 모르겠다.

문제가 생긴 NSDictionary의 부분은 이러하다.

    /// interface
    NSDictionary *dict;
    
    ///implement
    dict = [NSDictionary dictionary];
    [dict setValue:bridge forKey:@"JE"];
    
    ///EasyWKWebViewController 라이브러리 사용
    [_webView initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) configuration:config withJavascriptInterfaces:dict];
    
    ...

 

document를 보면 내가 사용한 dictionary는 빈 dictionary를 생성한다고 한다.

근데 다들 알다시피 NSDictionary는 Mutable이 아니기 때문에 변경이 불가능 하다.

난 거기다가 setValue를 한거고 ㅋ..

 

그러니 this class is not key value coding-compliant for the key JE. 라는 오류가 뜰 수밖에;

심지어 setValue:undefineded 라고 되어 있네..

그러니 아래처럼 고치면 된다.

    /// interface
    NSDictionary *dict;
    
    ///implement
    dict = [[NSDictionary alloc] initWithObjects:@[bridge] forKeys:@[@"JE"]];
    
    ///EasyWKWebViewController 라이브러리 사용
    [_webView initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) configuration:config withJavascriptInterfaces:dict];
    
    ...​

 

끝.

 

블로그의 정보

Beautiful Coding

사슴비행기

활동하기