【问题标题】:Has anyone been able to install ChildBrowser on Cordova 2.0.0 successfully?有没有人能够在 Cordova 2.0.0 上成功安装 ChildBrowser?
【发布时间】:2012-07-25 02:57:36
【问题描述】:

几天前我将 phonegap 升级到 2.0 (Cordova-2.0.0)。 我使用以下说明将 ChildBrowser 插件添加到 cordova: https://github.com/alunny/ChildBrowser/blob/master/README.md (使用 pluginstall 和 npm 运行自动化脚本来设置代码的本机部分),按照: https://github.com/alunny/pluginstall

但是,自动化脚本似乎采用了较旧的 PhoneGap 代码而不是 Cordova,因此我必须在 ChildBrowser 插件的 .m 和 .h 文件中进行更改,以使用 CDV* 类而不是 PG* 类。另外,脚本搞砸了我的 xcode 项目,幸好我有备份。

所有这些都引出了一个问题——有没有关于如何使 ChildBrowser 插件在 Cordova 2.0.0 上工作的文档?我看到很多人抱怨 Cordova 1.9.0。

【问题讨论】:

  • 你在哪个平台上开发? iPhone、Android 还是 Windows 手机?

标签: ios cordova phonegap-plugins cordova-2.0.0 childbrowser


【解决方案1】:

我几乎可以使用它,但它仍然没有为我打开。但这似乎对here on google groups这个家伙有用。

删除任何 #ifdef CORDOVA_FRAMEWORK 语句,根据 Phonegap 文档,不再需要此语句。因此,例如在您的 ChildBrowserCommand.h 文件中更改:

#ifdef CORDOVA_FRAMEWORK
#import <CORDOVA/CDVPlugin.h>
#else
#import "CORDOVA/CDVPlugin.h"
#endif
#import "ChildBrowserViewController.h"

只是:

#import <CORDOVA/CDVPlugin.h>
#import "ChildBrowserViewController.h"

还有这个:

#ifdef CORDOVA_FRAMEWORK
    @interface ChildBrowserCommand : CDVPlugin <ChildBrowserDelegate>  {
#endif
    ChildBrowserViewController* childBrowser;
}

进入:

@interface ChildBrowserCommand : CDVPlugin <ChildBrowserDelegate>  {
  ChildBrowserViewController* childBrowser;
}

您也可以查看this。让我知道这是否适合您,或者您是否找到了可行的解决方案,以便我也可以尝试。

【讨论】:

  • @dda,尝试了上面的插件升级指南和解决方案,项目构建,但没有运行。我在 js 中执行以下操作:window.ChildBrowser.showWebPage(url);
【解决方案2】:

设法让这个工作。确保您使用的是 phonegap GitHub 存储库中 iOS 分支中的 ChildBrowser 代码,而不是 iPhone 文件夹中的。

【讨论】:

  • 我不敢相信我花了两个小时在这上面,因为我从错误的文件夹中安装了它。感谢您的提示!它为我解决了它。多么不清楚......
【解决方案3】:

这里的所有解释都像魅力一样:http://blog.digitalbackcountry.com/2012/03/installing-the-childbrowser-plugin-for-ios-with-phonegapcordova-1-5/

对于 Cordova 2.3.0,您应该修改 config.xml,因为 cordova.plist 不再存在。 喜欢:

<plugins>
    <plugin name="ChildBrowser" value="ChildBrowser.js" />
    <plugin name="ChildBrowserCommand" value="ChildBrowserCommand" />
   …
</plugins>

【讨论】:

    【解决方案4】:

    各位,对不起,我无法制作完整的教程或博客文章,但我知道下一个最好的事情

    结帐this github repo,你会找到实现目标的步骤和一个工作项目,我这样做只是为了帮助你们,但请注意我也是一个菜鸟,我刚开始使用 phonegap,所以如果你有任何 cmets或建议请拉请求或评论

    附:第一个提交标题 Initial Commit 只是默认的 PhoneGap 模板,无需查看,之后查看每个提交。

    谢谢

    【讨论】:

      猜你喜欢
      • 2011-05-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-16
      • 1970-01-01
      • 2018-08-14
      • 2011-07-25
      • 1970-01-01
      相关资源
      最近更新 更多