attempt to insert nil object from objects[0]
by 사슴비행기아래와 같은 오류가 떴다.
2019-09-04 15:08:46.196386+0900 JeungObjc[5524:730049] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(
0 CoreFoundation 0x00000001051878db __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000010472aac5 objc_exception_throw + 48
2 CoreFoundation 0x00000001050d5fac _CFThrowFormattedException + 194
3 CoreFoundation 0x0000000105161a4d -[__NSPlaceholderArray initWithObjects:count:] + 237
4 CoreFoundation 0x0000000105176484 +[NSArray arrayWithObjects:count:] + 52
5 JeungObjc 0x0000000102900a04 -[TestJS getMessage] + 164
6 JeungObjc 0x000000010290080d -[TestJS sendMessage:message:] + 173
7 CoreFoundation 0x000000010518e6ac __invoking___ + 140
8 CoreFoundation 0x000000010518bc25 -[NSInvocation invoke] + 325
9 JeungObjc 0x000000010293bccf -[EasyJSListener userContentController:didReceiveScriptMessage:] + 2143
10 WebKit 0x00000001037fdff3 _ZN28ScriptMessageHandlerDelegate14didPostMessageERN6WebKit12WebPageProxyERKNS0_13FrameInfoDataERN7WebCore21SerializedScriptValueE + 213
11 WebKit 0x00000001039596cb _ZN6WebKit29WebUserContentControllerProxy14didPostMessageERN3IPC10ConnectionEyRKNS_13FrameInfoDataEyRKNS1_13DataReferenceE + 167
12 WebKit 0x0000000103ad2126 _ZN3IPC13handleMessageIN8Messages29WebUserContentControllerProxy14DidPostMessageEN6WebKit29WebUserContentControllerProxyEMS5_FvRNS_10ConnectionEyRKNS4_13FrameInfoDataEyRKNS_13DataReferenceEEEEvS7_RNS_7DecoderEPT0_T1_ + 228
13 WebKit 0x00000001036eeb46 _ZN3IPC18MessageReceiverMap15dispatchMessageERNS_10ConnectionERNS_7DecoderE + 126
14 WebKit 0x00000001038a7e84 _ZN6WebKit15WebProcessProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 24
15 WebKit 0x00000001036e1a18 _ZN3IPC10Connection15dispatchMessageENSt3__110unique_ptrINS_7DecoderENS1_14default_deleteIS3_EEEE + 108
16 WebKit 0x00000001036e44eb _ZN3IPC10Connection24dispatchIncomingMessagesEv + 907
17 JavaScriptCore 0x000000010edf32e4 _ZN3WTF7RunLoop11performWorkEv + 228
18 JavaScriptCore 0x000000010edf3572 _ZN3WTF7RunLoop11performWorkEPv + 34
19 CoreFoundation 0x00000001050eedb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
20 CoreFoundation 0x00000001050ee633 __CFRunLoopDoSources0 + 243
21 CoreFoundation 0x00000001050e8cef __CFRunLoopRun + 1231
22 CoreFoundation 0x00000001050e84d2 CFRunLoopRunSpecific + 626
23 GraphicsServices 0x00000001095332fe GSEventRunModal + 65
24 UIKitCore 0x0000000109faafc2 UIApplicationMain + 140
25 JeungObjc 0x0000000102900730 main + 112
26 libdyld.dylib 0x000000010680e541 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
디버그를 한 줄씩 넘기던 중 아래 코드에서 문제가 생긴다는 걸 알았다.
NSArray라는 언급이 있어서 key와 value 넣는 방식에 문제가 있나 싶어
아래와 같이 변경해보았다.
그랬더니 이번에는 이런 오류가 발생했다.
second object of each pair must be non-nil. Or, did you forget to nil-terminate your parameter list?
2019-09-04 15:31:08.677590+0900 JeungObjc[5751:814347] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSPlaceholderDictionary initWithObjectsAndKeys:]: second object of each pair must be non-nil. Or, did you forget to nil-terminate your parameter list?'
*** First throw call stack:
(
0 CoreFoundation 0x000000010b5ce8db __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000010ab71ac5 objc_exception_throw + 48
2 CoreFoundation 0x000000010b5ca19a -[NSDictionary initWithObjectsAndKeys:] + 1002
3 JeungObjc 0x0000000108d47ad1 -[TestJS getMessage] + 145
4 JeungObjc 0x0000000108d478ef -[TestJS sendMessage:message:] + 255
5 CoreFoundation 0x000000010b5d56ac __invoking___ + 140
6 CoreFoundation 0x000000010b5d2c25 -[NSInvocation invoke] + 325
7 JeungObjc 0x0000000108d82ccf -[EasyJSListener userContentController:didReceiveScriptMessage:] + 2143
8 WebKit 0x0000000109c44ff3 _ZN28ScriptMessageHandlerDelegate14didPostMessageERN6WebKit12WebPageProxyERKNS0_13FrameInfoDataERN7WebCore21SerializedScriptValueE + 213
9 WebKit 0x0000000109da06cb _ZN6WebKit29WebUserContentControllerProxy14didPostMessageERN3IPC10ConnectionEyRKNS_13FrameInfoDataEyRKNS1_13DataReferenceE + 167
10 WebKit 0x0000000109f19126 _ZN3IPC13handleMessageIN8Messages29WebUserContentControllerProxy14DidPostMessageEN6WebKit29WebUserContentControllerProxyEMS5_FvRNS_10ConnectionEyRKNS4_13FrameInfoDataEyRKNS_13DataReferenceEEEEvS7_RNS_7DecoderEPT0_T1_ + 228
11 WebKit 0x0000000109b35b46 _ZN3IPC18MessageReceiverMap15dispatchMessageERNS_10ConnectionERNS_7DecoderE + 126
12 WebKit 0x0000000109ceee84 _ZN6WebKit15WebProcessProxy17didReceiveMessageERN3IPC10ConnectionERNS1_7DecoderE + 24
13 WebKit 0x0000000109b28a18 _ZN3IPC10Connection15dispatchMessageENSt3__110unique_ptrINS_7DecoderENS1_14default_deleteIS3_EEEE + 108
14 WebKit 0x0000000109b2b42d _ZN3IPC10Connection24dispatchIncomingMessagesEv + 717
15 JavaScriptCore 0x000000011516f2e4 _ZN3WTF7RunLoop11performWorkEv + 228
16 JavaScriptCore 0x000000011516f572 _ZN3WTF7RunLoop11performWorkEPv + 34
17 CoreFoundation 0x000000010b535db1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
18 CoreFoundation 0x000000010b535633 __CFRunLoopDoSources0 + 243
19 CoreFoundation 0x000000010b52fcef __CFRunLoopRun + 1231
20 CoreFoundation 0x000000010b52f4d2 CFRunLoopRunSpecific + 626
21 GraphicsServices 0x00000001131522fe GSEventRunModal + 65
22 UIKitCore 0x000000010f493fc2 UIApplicationMain + 140
23 JeungObjc 0x0000000108d477c0 main + 112
24 libdyld.dylib 0x000000010cc55541 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
nil로 끝맺는걸 까먹었거나 뭔가 object에 nil이 들어갔다는 말 같아서 살펴보니
세상에.. 이런 실수를 ㅠㅠ
callbackName을 저장하는 함수에서 변수 이름이 똑같아서
정작 멤버변수에 값이 안들어가고 있었던 것... 그러니 nil이지 ㅋㅋㅋ
@interface TestJS() {
NSMutableString *message;
NSMutableString *callBackName;
}
@end
멤버변수 이름을 바꾸고 해당 변수를 사용하는 곳에서도 모두 이름을 바뀐대로 바꿔주니 정상 작동한다.
'objective-c > error resolve and collect' 카테고리의 다른 글
블로그의 정보
Beautiful Coding
사슴비행기