Xcode 11.4.1 버전에서 swift로 아이폰 WebKit 사용시 애플리케이션 실행하면 아래와 같은 에러가 떨어진다.
2020-05-23 16:47:48.942243+0900 Web[2135:81352]
*** 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 0x00007fff23e39f0e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50ad79b2 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23e39d4c +[NSException raise:format:] + 188
3 UIFoundation 0x00007fff480460ed UINibDecoderDecodeObjectForValue + 352
4 UIFoundation 0x00007fff48045f80 -[UINibDecoder decodeObjectForKey:] + 251
5 UIKitCore 0x00007fff48822ac1 -[UIRuntimeConnection initWithCoder:] + 160
6 UIFoundation 0x00007fff48046274 UINibDecoderDecodeObjectForValue + 743
7 UIFoundation 0x00007fff48046518 UINibDecoderDecodeObjectForValue + 1419
8 UIFoundation 0x00007fff48045f80 -[UINibDecoder decodeObjectForKey:] + 251
9 UIKitCore 0x00007fff4881d8d9 -[NSCoder(UIIBDependencyInjectionInternal) _decodeObjectsWithSourceSegueTemplate:creator:sender:forKey:] + 450
10 UIKitCore 0x00007fff488205ec -[UINib instantiateWithOwner:options:] + 1120
11 UIKitCore 0x00007fff4851eb0e -[UIViewController _loadViewFromNibNamed:bundle:] + 379
12 UIKitCore 0x00007fff4851f645 -[UIViewController loadView] + 177
13 UIKitCore 0x00007fff4851f944 -[UIViewController loadViewIfRequired] + 172
14 UIKitCore 0x00007fff485200f1 -[UIViewController view] + 27
15 UIKitCore 0x00007fff48c00841 -[UIWindow addRootViewControllerViewIfPossible] + 326
16 UIKitCore 0x00007fff48bffe6a -[UIWindow _updateLayerOrderingAndSetLayerHidden:actionBlock:] + 219
17 UIKitCore 0x00007fff48c00ef5 -[UIWindow _setHidden:forced:] + 362
18 UIKitCore 0x00007fff48c1431c -[UIWindow _mainQueue_makeKeyAndVisible] + 42
19 UIKitCore 0x00007fff48e33a8c -[UIWindowScene _makeKeyAndVisibleIfNeeded] + 202
20 UIKitCore 0x00007fff48126470 +[UIScene _sceneForFBSScene:create:withSession:connectionOptions:] + 1405
21 UIKitCore 0x00007fff48bc42c1 -[UIApplication _connectUISceneFromFBSScene:transitionContext:] + 1019
22 UIKitCore 0x00007fff48bc45f8 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 291
23 UIKitCore 0x00007fff48718ec0 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
24 FrontBoardServices 0x00007fff36c35d2e -[FBSSceneImpl _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 419
25 FrontBoardServices 0x00007fff36c5bdc1 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke.154 + 102
26 FrontBoardServices 0x00007fff36c40757 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 220
27 FrontBoardServices 0x00007fff36c5ba52 __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke + 355
28 libdispatch.dylib 0x000000010fca7e8e _dispatch_client_callout + 8
29 libdispatch.dylib 0x000000010fcaada2 _dispatch_block_invoke_direct + 300
30 FrontBoardServices 0x00007fff36c816e9 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
31 FrontBoardServices 0x00007fff36c813d7 -[FBSSerialQueue _queue_performNextIfPossible] + 441
32 FrontBoardServices 0x00007fff36c818e6 -[FBSSerialQueue _performNextFromRunLoopSource] + 22
33 CoreFoundation 0x00007fff23d9deb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
34 CoreFoundation 0x00007fff23d9dddc __CFRunLoopDoSource0 + 76
35 CoreFoundation 0x00007fff23d9d60c __CFRunLoopDoSources0 + 268
36 CoreFoundation 0x00007fff23d981ae __CFRunLoopRun + 974
37 CoreFoundation 0x00007fff23d97ac4 CFRunLoopRunSpecific + 404
38 GraphicsServices 0x00007fff38b2fc1a GSEventRunModal + 139
39 UIKitCore 0x00007fff48bc7f80 UIApplicationMain + 1605
40 Web 0x000000010fa3065b main + 75
41 libdyld.dylib 0x00007fff519521fd start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
라이브러리 임폴트가 안됐나 해서...
import WebKit
......
임폴트를 추가해 봐도 같은 에러가 발생했다.
결론적으로 해결 방법은
1. 프로잭트 클릭
2.Build Phases 클릭
3.add(+) 버튼 클릭
4.WebKit라이브러리 검색후
5.Add하면 끝~~
반응형