forge.tabbar如何工作?记录的示例不起作用

时间:2012-06-12 02:31:56

标签: javascript trigger.io forge

我有一个标准的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();",not" window.forge.debug = true ;"

我在Catalyst中没有输出,但是我得到了#34;错误"警报,我的控制台上写着:

[   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

标签栏显示但没有按钮。

为什么我会收到这些错误,我该如何解决?

2 个答案:

答案 0 :(得分:2)

首先,感谢指出过时的FAQ条目 - 我已相应更新了我们的文档。

我已经尝试了您粘贴的代码段,并且所有内容都按预期工作:当我点击按钮时,我会收到“我的故事”提醒。

注意:我认为如果出现问题,您会尝试显示错误提醒?为此,请将错误回调更改为:

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

由于我无法从您的代码段重新创建,如果您仍然遇到问题,请将您的src目录的zip文件发送到support@trigger.io,我们很乐意再看一下这些内容!

答案 1 :(得分:0)

“发送到实例0x8fe30e0的无法识别的选择器”对我来说听起来像是你图像名称中的“@”符号搞乱了。