WKWebKitを使用した際のThread 1: signal SIGABRTエラーの解決方法
取得したURLのページをWKWebKitを使用して表示しようとした際に問題が発生。
なぜかThread 1: signal SIGABRTエラーが発生してしまった。
以下がエラー内容。
Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named WKWebView because no class named WKWebView was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)'
*** First throw call stack:
(
0 CoreFoundation 0x000000010577c6fb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000104d20ac5 objc_exception_throw + 48
2 CoreFoundation 0x000000010577c555 +[NSException raise:format:] + 197
3 UIFoundation 0x000000010eada6c9 UINibDecoderDecodeObjectForValue + 360
4 UIFoundation 0x000000010eadaaf9 UINibDecoderDecodeObjectForValue + 1432
5 UIFoundation 0x000000010eada554 -[UINibDecoder decodeObjectForKey:] + 251
6 UIKitCore 0x0000000109499705 -[UIView initWithCoder:] + 802
7 UIFoundation 0x000000010eada852 UINibDecoderDecodeObjectForValue + 753
8 UIFoundation 0x000000010eada554 -[UINibDecoder decodeObjectForKey:] + 251
9 UIKitCore 0x0000000108c7eb41 -[UIRuntimeConnection initWithCoder:] + 178
10 UIFoundation 0x000000010eada852 UINibDecoderDecodeObjectForValue + 753
11 UIFoundation 0x000000010eadaaf9 UINibDecoderDecodeObjectForValue + 1432
12 UIFoundation 0x000000010eada554 -[UINibDecoder decodeObjectForKey:] + 251
13 UIKitCore 0x0000000108c7c3f1 -[UINib instantiateWithOwner:options:] + 1216
14 UIKitCore 0x00000001089f93af -[UIViewController _loadViewFromNibNamed:bundle:] + 382
15 UIKitCore 0x00000001089f9d39 -[UIViewController loadView] + 177
16 UIKitCore 0x00000001089fa048 -[UIViewController loadViewIfRequired] + 172
17 UIKitCore 0x00000001089fa868 -[UIViewController view] + 27
18 UIKitCore 0x00000001089493d0 -[UINavigationController _startCustomTransition:] + 929
19 UIKitCore 0x000000010895f31a -[UINavigationController _startDeferredTransitionIfNeeded:] + 741
20 UIKitCore 0x00000001089606a7 -[UINavigationController __viewWillLayoutSubviews] + 150
21 UIKitCore 0x000000010894138d -[UILayoutContainerView layoutSubviews] + 217
22 UIKitCore 0x00000001094ca9c1 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1417
23 QuartzCore 0x000000010aa3beae -[CALayer layoutSublayers] + 173
24 QuartzCore 0x000000010aa40b88 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 396
25 QuartzCore 0x000000010aa4cee4 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 72
26 QuartzCore 0x000000010a9bc3aa _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 328
27 QuartzCore 0x000000010a9f3584 _ZN2CA11Transaction6commitEv + 608
28 UIKitCore 0x00000001090243a4 _afterCACommitHandler + 245
29 CoreFoundation 0x00000001056e30f7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
30 CoreFoundation 0x00000001056dd5be __CFRunLoopDoObservers + 430
31 CoreFoundation 0x00000001056ddc31 __CFRunLoopRun + 1505
32 CoreFoundation 0x00000001056dd302 CFRunLoopRunSpecific + 626
33 GraphicsServices 0x000000010e77e2fe GSEventRunModal + 65
34 UIKitCore 0x0000000108ffcba2 UIApplicationMain + 140
35 MySearchApp 0x000000010440259b main + 75
36 libdyld.dylib 0x0000000107b6d541 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
WKWebKitを使用する際には、Build PhasesのLink Binary With LibrariesでWebKit.frameworkをリンクする必要があるのだが、その設定ができていなかった。
ちなみに、エラー個所を探そうと思ってブレークを貼るとなぜかエラーが発生しなかった・・・。
なぜエラーが発生したのかはいまいち分からない・・・。
結構難しい話が絡んできそうなので説明できるようになった際に追記を行おうと思う。