【问题标题】:How does the forge.tabbar work? The documented example is not workingforge.tabbar 是如何工作的?记录的示例不起作用
【发布时间】:2012-06-14 22:27:12
【问题描述】:

我有一个标准的 Forge 生成的 Trigger.io 应用程序,我制作了一个单独的应用程序来测试它。

我将“tabbar: true”添加到 config.json,将名为“pencil@2x.png”的图像复制到“/img”目录,并在所有其他文件中保留其他所有内容。同样在“default.js”中我有:

forge.enableDebug();
forge.tabbar.addButton({
  icon: "img/pencil@2x.png",
  text: "Pencil"
}, function (button) {
  button.setActive();
  button.onPressed.addListener(function () {
    alert("My Stories");
  });
}, alert('Error'));

注意:文档 here 已过时,应该说“forge.enableDebug();”,而不是“window.forge.debug = true;”

我在 Catalyst 中没有得到任何输出,但我收到“错误”警报,并且我的控制台显示:

[   INFO] Showing log output:
2012-06-11 21:14:41.759 ios-sim-xc4.3[90599:507] stderrPath: /var/folders/d_/b7n2d1qn23z7zx2gfmhh22d80000gp/T/tmpsCqHJK
[   INFO] 2012-06-11 21:14:42.827 Forge[90605:1a603] [INFO] Device rotated.
[   INFO] 2012-06-11 21:14:42.844 Forge[90605:1a603] [INFO] Loading default page in webview.
[   INFO] 2012-06-11 21:14:42.850 Forge[90605:1a603] [INFO] Device rotated.
[   INFO] 2012-06-11 21:14:42.851 Forge[90605:1a603] [INFO] Device rotated.
[   INFO] 2012-06-11 21:14:42.861 Forge[90605:1a603] [INFO] Loading local url in webview: file:///Users/Name/Library/Application%20Support/iPhone%20Simulator/5.1/Applications/82F1256F-C533-4CD7-864B-74545EAE346A/simulator-ios.app/assets/src/index.html
[   INFO] 2012-06-11 21:14:49.518 Forge[90605:1a603] -[JKArray isEqualToString:]: unrecognized selector sent to instance 0x8fe30e0
[   INFO] 2012-06-11 21:14:49.519 Forge[90605:1a603] *** WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSInvalidArgumentException> -[JKArray isEqualToString:]: unrecognized selector sent to instance 0x8fe30e0

标签栏出现了,但上面没有按钮。

为什么会出现这些错误,我该如何解决。

【问题讨论】:

  • 你试过不使用“@”符号吗?这闻起来“无法识别的选择器发送到实例 0x8fe30e0”。

标签: javascript trigger.io forge


【解决方案1】:

首先,感谢您指出过期的常见问题解答条目 - 我已经相应地更新了我们的文档。

我已经尝试了您粘贴的代码 sn-p,一切正常:单击按钮时,我收到“我的故事”警报。

注意:我认为您是在尝试在出现问题时显示错误警报?为此,请将错误回调更改为:

function (err) { alert('Error'); }

由于我无法从您的 sn-p 重新创建,如果您仍然遇到问题,请将您的 src 目录的 zip 发送到 support@trigger.io,我们很乐意再看看这个!

【讨论】:

  • 是的,它是可选的 - 只是它正在被评估并立即运行,这可能会让人感到困惑!
【解决方案2】:

“发送到实例 0x8fe30e0 的无法识别的选择器”在我看来就像是图像名称中的“@”符号搞砸了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-09-30
    • 2019-03-18
    • 1970-01-01
    • 1970-01-01
    • 2013-10-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多