skimemo


skimemo - 日記/2020-10-12

_ RadSideDrawerで'nativescript-ui-sidedrawer' not foundエラーが出るとき

_ 概要

  • RadSideDrawerプラグインを追加して実装してもエラーが出る
  • テンプレートを使って新たなプロジェクトを作成し、コピーしたら直った

_ 現象

アプリ開発でサイドドロワーは必須のコンポーネントですが、NativeScript6で以下のようにプラグインを追加し、XML等を記述しても、実行時にエラーが発生します。

tns plugin add nativescript-ui-sidedrawer

エラー

***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1   0x104a7662e NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
2   0x104ab73a8 NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*)
3   0x1054b2c90 ffi_closure_unix64_inner
4   0x1054b36b2 ffi_closure_unix64 
5   0x7fff2037bc15 ___CFXRegistrationPost_block_invoke
6   0x7fff2037b333 _CFXRegistrationPost
7   0x7fff2037aca1 _CFXNotificationPost
8   0x7fff207fc3ba -[NSNotificationCenter postNotificationName:object:userInfo:]
9   0x7fff2465ea55 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:]
10  0x7fff246643c9 -[UIApplication _runWithMainScene:transitionContext:completion:]
11  0x7fff23c97b95 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:]
12  0x7fff2421f632 _UIScenePerformActionsWithLifecycleActionMask
13  0x7fff23c986a4 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke
14  0x7fff23c98168 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:]
15  0x7fff23c984d5 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]
16  0x7fff23c97d69 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:]
17  0x7fff23c9ff2e __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke
18  0x7fff241298f3 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:]
19  0x7fff2423c062 _UISceneSettingsDiffActionPerformChangesWithTransitionContext
20  0x7fff23c9fccf -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]
21  0x7fff23ac62c3 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke
22  0x7fff23ac4d6d -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:]
23  0x7fff23ac5efc -[UIScene scene:didUpdateWithDiff:transitionContext:completion:]
24  0x7fff24662835 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:]
25  0x7fff24151c27 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:]
26  0x7fff25a56146 -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:]
27  0x7fff25a7ec0d __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.176
28  0x7fff25a63ba1 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:]
29  0x7fff25a7e8db __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke
30  0x7fff20106534 _dispatch_client_callout
31  0x7fff2010907e _dispatch_block_invoke_direct
JavaScript stack trace:
file: node_modules/@nativescript/core/ui/builder/builder.js:202:0
at file: node_modules/@nativescript/core/xml/xml.js:146:0
at file: node_modules/@nativescript/core/js-libs/easysax/easysax.js:751:0
at file: node_modules/@nativescript/core/xml/xml.js:193:0
at file: node_modules/@nativescript/core/ui/builder/builder.js:208:0
at parseInternal(file: node_modules/@nativescript/core/ui/builder/builder.js:170:0)
at loadInternal(file: node_modules/@nativescript/core/ui/builder/builder.js:97:0)
at file: node_modules/@nativescript/core/ui/builder/builder.js:37:0
at createRootView(file: node_modules/@nativescript/core/application/application.ios.js:292:0)
at file: node_modules/@nativescript/core/application/application.ios.js:243:0
at file: node_modules/@nativescript/core/application/application.ios.js:174:0
at file: node_modules/@nativescript/core/application/application.ios.js:163:0
at [native code]
at file: node_modules/@nativescript/core/application/application.ios.js:36:0
at UIApplicationMain([native code])
at run(file: node_modules/@nativescript/core/application/application.ios.js:312:0)
at file:///app/bundle.js:247:69
at ./app.ts(file:///app/bundle.js:265:34)
at __webpack_require__(file: app/webpack/bootstrap:750:0)
at checkDeferredModules(file: app/webpack/bootstrap:43:0)
at webpackJsonpCallback(file: app/webpack/bootstrap:30:0)
at anonymous(file:///app/bundle.js:2:61)
at evaluate([native code])
at moduleEvaluation([native code])
at [native code]
at asyncFunctionResume([native code])
at [native code]
at promiseReactionJob([native code])
JavaScript error:
file: node_modules/@nativescript/core/ui/builder/builder.js:202:0: JS ERROR Error: Building UI from XML. @app-login-page.xml:1:1
> Module 'nativescript-ui-sidedrawer' not found for element 'nativescript-ui-sidedrawer:RadSideDrawer'.
> The superclass is not an object.
(CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Error: Building UI from XML. @app-login-page.xml:1:1
> Module 'nativescript-ui-sidedrawer' not found for element 'nativescript-ui-sidedrawer:RadSideDrawer'.
> The superclass is not an object.
at
file: node_modules/@nativescript/core/ui/builder/builder.js:202:0
at file: node_modules/@nativescript/core/xml/xml.js:146:0
at file: node_modules/@nativescript/core/js-libs/easysax/easysax.js:751:0
at file: node_modules/@nativescript/core/xml/xml.js:193:0
at file: node_modules/@nativescript/core/ui/builder/builder.js:208:0
at parseInternal(file: node_modules/@nativescript/core/ui/builder/builder.js:170:0)
at loadInternal(file: node_modules/@nativescript/core/ui/builder/builder.js:97:0)
at file: node_modules/@nativescript/core/ui/builder/builder.js:37:0
at createRootView(file: node_modules/@nativescript/core/application/application.ios.js:292:0)
at file: node_modules/@nativescript/core/application/application.ios.js:243:0
at file: node_modules/@nativescript/core/application/application.ios.js:174:0
at file: node_modules/@nativescript/core/application/application.ios.js:163:0
at [native code]
at file: node_modules/@nativescript/core/application/application.ios.js:36:0
at UIApplicationMain([native code])
at run(file: node_modules/@nativescript/core/application/application.ios.js:312:0)
at file:///app/bundle.js:247:69
at ./app.ts(file:///app/bundle.js:265:34)
at __webpack_require__(file: app/webpack/bootstrap:750:0)
at checkDeferredModules(file:///app/<…>
NativeScript caught signal 6.
Native Stack:
1   0x104ac7171 sig_handler(int)
2   0x7fff5dccf5fd _sigtramp
3   0x1
4   0x7fff200fabd4 abort
5   0x7fff20250818 abort_message
6   0x7fff20241e7d demangling_unexpected_handler()
7   0x7fff201781d1 _objc_terminate()
8   0x7fff2024fc47 std::__terminate(void (*)())
9   0x7fff2024fbe9 std::terminate()
10  0x7fff20106548 _dispatch_client_callout
11  0x7fff2010907e _dispatch_block_invoke_direct
12  0x7fff25aa4901 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
13  0x7fff25aa45e7 -[FBSSerialQueue _targetQueue_performNextIfPossible]
14  0x7fff25aa4aac -[FBSSerialQueue _performNextFromRunLoopSource]
15  0x7fff203a8845 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
16  0x7fff203a873d __CFRunLoopDoSource0
17  0x7fff203a7c81 __CFRunLoopDoSources0
18  0x7fff203a23f7 __CFRunLoopRun
19  0x7fff203a1b9e CFRunLoopRunSpecific
20  0x7fff2b773db3 GSEventRunModal
21  0x7fff24660af3 -[UIApplication _run]
22  0x7fff24665a04 UIApplicationMain
23  0x1054b34f5 ffi_call_unix64
24  0x10babaf70
JS Stack:
UIApplicationMain([native code])
at run(file: node_modules/@nativescript/core/application/application.ios.js:312:0)
at file:///app/bundle.js:247:69
at ./app.ts(file:///app/bundle.js:265:34)
at __webpack_require__(file: app/webpack/bootstrap:750:0)
at checkDeferredModules(file: app/webpack/bootstrap:43:0)
at webpackJsonpCallback(file: app/webpack/bootstrap:30:0)
at anonymous(file:///app/bundle.js:2:61)
at evaluate([native code])
at moduleEvaluation
at
at asyncFunctionResume
at
at promiseReactionJob

GitHubからサンプルソースを落としてきても同じです。
いろいろ検索していると、nativescript-ui-sidedrawerプラグインは正常に入らないことがある、との記述をみかけました。
そして、テンプレートから作成したアプリは正常に動作することも見つけました。
そこで以下のようにしてみたら、見事自前アプリでも正常に動作しました。

  1. テンプレートでアプリを新規作成する
    tns create temp-app-name --template tns-template-drawer-navigation-ts

  2. nativescript-ui-sidedrawerをコピーする
    自分のアプリ> rm -rf node_modules/nativescript-ui-sidedrawer
    自分のアプリ> cp -r /{temp-app-nameのディレクトリ}/node_modules/nativescript-ui-sidedrawer ./node_modules

以上です。

Category: [NativeScript] - 14:30:15



 
Last-modified: 2020-10-12 (月) 14:30:15 (51d)