Meteor 可以与 PhoneGap 一起使用吗? [英] Can Meteor be used with PhoneGap?

查看:47
本文介绍了Meteor 可以与 PhoneGap 一起使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Meteor 模板是否可以打包并部署为 PhoneGap 应用程序?

Can a Meteor template be packaged up and deployed as a PhoneGap application?

推荐答案

是的,这是可能的,但不能通过在手机上打包meteor 应用程序.您必须将 phonegap 指向您的流星服务器(您仍然可以使用 API 来访问设备上的功能).以下是说明:

Yes, this is possible, but not by packaging the meteor app on the phone. You have to point phonegap to your meteor server instead (you will still be able to use the API for accessing functionality on the device). Here are the instructions:

  • Grab the latest copy of phonegap 2.2.* from https://github.com/phonegap/phonegap (2.1 has a bug that prevents this technique from working)
  • Create your phonegap project and whitelist your meteor server domain name using the instructions here: http://docs.phonegap.com/en/1.9.0/guide_whitelist_index.md.html
  • For iOS, find and open CordovaLib/Classes/CDVViewController.m and around line 175, overwrite appURL with appURL = [NSURL URLWithString:@"http://your-server.com"];

就是这样.编译并运行应用.

That's it. Compile and run the app.

节省一些时间:

  • 您可以通过将 www/目录内容复制到您的meteor 服务器根目录来开始设置您的meteor 目录.确保复制 client/目录下的 javascript 文件,以便它们在主流星 js 文件之前加载.
  • 从您的主流星 js 文件运行 app.initialize(window),如果不传递 window 参数,应用程序将崩溃.
  • 不要尝试在Xcode的www/目录下设置meteor服务器.您将无法部署到设备,因为 .meteor 子目录包含指向节点模块的符号链接.

这篇关于Meteor 可以与 PhoneGap 一起使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆