【问题标题】:Nativescript - ActionBar errorNativescript - 操作栏错误
【发布时间】:2016-07-15 12:23:38
【问题描述】:

早安,

我正在使用 Nativescript 创建一个 iOS 应用程序。我尝试在 iOS 中为 ActionBar 添加标题,但一直失败。我已经从我的代码中删除了 ActionBar 标记和任何痕迹,但我的应用程序无法启动,并且它不断给我以下输出和崩溃:

Jul 15 13:17:41 Shivas-Air cngMobileApp[18451]: 1   0x4840b0 NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*)
Jul 15 13:17:41 Shivas-Air cngMobileApp[18451]: 2   0xb316f8 ffi_closure_inner
Jul 15 13:17:41 Shivas-Air cngMobileApp[18451]: 3   0xb32022 ffi_closure_i386
Jul 15 13:17:41 Shivas-Air cngMobileApp[18451]: 4   0x1704ceb -[UIViewController __viewWillAppear:]
Jul 15 13:17:41 Shivas-Air cngMobileApp[18451]: 5   0x1706789 -[UIViewController viewWillMoveToWindow:]
Jul 15 13:17:41 Shivas-Air cngMobileApp[18451]: 6   0x15e98bb -[UIView(Hierarchy) _willMoveToWindow:withAncestorView:]
Jul 15 13:17:41 Shivas-Air cngMobileApp[18451]: 7   0x15fa0f8 -[UIView(Internal) _addSubview:positioned:relativeTo:]
Jul 15 13:17:41 Shivas-Air cngMobileApp[18451]: 8   0x15e8cc8 -[UIView(Hierarchy) addSubview:]
Jul 15 13:17:41 Shivas-Air cngMobileApp[18451]: 9   0xb31ee8 ffi_call_i386
Jul 15 13:17:41 Shivas-Air cngMobileApp[18451]: **file:///app/tns_modules/ui/page/page.js:314:35: JS ERROR TypeError: frame._updateActionBar is not a function. (In 'frame._updateActionBar(this)', 'frame._updateActionBar' is undefined)
Jul 15 13:17:41 Shivas-Air com.apple.CoreSimulator.SimDevice.20124C04-21CD-486F-9DFE-439512DD31BD.launchd_sim[18070]** (UIKitApplication:org.nativescript.cngMobileApp[0xc804][18451]): Service exited due to signal: Segmentation fault: 11

请注意以粗体显示的区域。我从平台文件夹中删除了我的 ios 文件夹并重新添加了平台,但仍然没有解决问题。感谢您提供任何帮助。

【问题讨论】:

    标签: ios nativescript


    【解决方案1】:

    我自己在尝试使用 DropDown 第三方插件时遇到了同样的问题。问题的根本原因是我对 NativeScript 和 Angular2 如何工作的误解。

    基本上,就我而言,DropDown 文档声明组件的 html 代码必须放在 &lt;Page&gt;&lt;/Page&gt; 标记之间。但是,使用Angular2,这个标签就不需要了,所以HTML代码一般不包含&lt;Page&gt;标签。

    我需要做的就是:

    • main.ts: import { registerElement } from "nativescript-angular/element-registry";

    • 然后,调用: registerElement("DropDown", () =&gt; require("nativescript-drop-down/drop-down").DropDown);

    这里要注意的重要一点是registerElement 函数的第一个参数是标签本身,所以在我的例子中,HTML 代码中使用的标签是&lt;DropDown&gt;&lt;/DropDown&gt;

    【讨论】:

      【解决方案2】:

      在我的 HTML 文件中,我有一个标签,然后是一个带有各自结束标签的标签。我从所有 HTML 文件中删除了 and 标记,我的项目成功编译并运行。

      【讨论】:

      • 您能否提供一个更具可读性/可理解性的答案?我陷入了同样的境地。非常感谢您。
      猜你喜欢
      • 1970-01-01
      • 2016-01-27
      • 2018-07-26
      • 2020-06-25
      • 1970-01-01
      • 2017-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多