Corona、Phonegap、Titanium的比较 [英] Comparison between Corona, Phonegap, Titanium

查看:22
本文介绍了Corona、Phonegap、Titanium的比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名网络开发人员,我想将我的网络产品转移到 iPhone.其中一款产品类似于谷歌地图:在手机屏幕上显示地图,您可以拖动地图或调整地图大小并查看我们添加到地图中的一些信息.

I am a web developer and I want to move my web products to iPhone. One of the products is like Google Maps: show map on the phone screen, you can drag or resize the map and view some information that we add to the map.

我知道有一些技术可以让您使用 HTML、CSS 和 Javascript 来开发原生 iPhone 应用程序.我已经确定了一些:

I know there are some technologies that enables you to use HTML, CSS and Javascript to develop native iPhone apps. I've identified a few:

还有其他类似的产品吗?它们之间有什么区别?我应该选择哪个?

Are there other, similar products? What are the differences between them? Which should I choose?

推荐答案

我注册 stackoverflow 只是为了评论顶部的大多数投票答案.不好的是 stackoverflow 不允许新成员发表评论.所以我必须让这个评论看起来更像是一个答案.

I registered with stackoverflow just for the purpose of commenting on the mostly voted answer on top. The bad thing is stackoverflow does not allow new members to post comments. So I have to make this comment more look like an answer.

Rory Blyth 的回答包含一些关于这两个 javascript 移动框架的有效观点.然而,他的关键点是不正确的.事实是,Titanium 和 PhoneGap 相似多于不同.它们都通过一组 javascript API 公开手机功能,并且应用程序的逻辑(html、css、javascript)运行在原生 WebView 控件中.

Rory Blyth's answer contains some valid points about the two javascript mobile frameworks. However, his key points are incorrect. The truth is that Titanium and PhoneGap are more similar than different. They both expose mobile phone functions through a set of javascript APIs, and the application's logic (html, css, javascript) runs inside a native WebView control.

  1. PhoneGap 不仅仅是 Web 应用程序的本机包装器.通过PhoneGap javascript API,web app"可以访问手机功能,如地理定位、加速度计相机、联系人、数据库、文件系统等.基本上手机SDK提供的任何功能都可以桥接"到javascript 世界.另一方面,在移动网络浏览器上运行的普通网络应用程序无法访问大多数这些功能(安全是主要原因).因此,PhoneGap 应用程序更像是一个移动应用程序,而不是一个网络应用程序.您当然可以使用 PhoneGap 来包装一个根本不使用任何 PhoneGap API 的网络应用程序,但这不是 PhoneGap 的创建目的.

  1. PhoneGap is not just a native wrapper of a web app. Through the PhoneGap javascript APIs, the "web app" has access to the mobile phone functions such as Geolocation, Accelerometer Camera, Contacts, Database, File system, etc. Basically any function that the mobile phone SDK provides can be "bridged" to the javascript world. On the other hand, a normal web app that runs on the mobile web browser does not have access to most of these functions (security being the primary reason). Therefore, a PhoneGap app is more of a mobile app than a web app. You can certainly use PhoneGap to wrap a web app that does not use any PhoneGap APIs at all, but that is not what PhoneGap was created for.

Titanium 不会将您的 html、css 或 javascript 代码编译为本机位".它们被打包为可执行包的资源,很像嵌入的图像文件.当应用程序运行时,这些资源被加载到 UIWebView 控件中并在那里运行(作为 javascript,当然不是本机位).没有 javascript-to-native-code(或 to-objective-c)编译器这样的东西.这在 PhoneGap 中也是以同样的方式完成的.从架构的角度来看,这两个框架非常相似.

Titanium does NOT compile your html, css or javascript code into "native bits". They are packaged as resources to the executable bundle, much like an embedded image file. When the application runs, these resources are loaded into a UIWebView control and run there (as javascript, not native bits, of course). There is no such thing as a javascript-to-native-code (or to-objective-c) compiler. This is done the same way in PhoneGap as well. From architectural standpoint, these two frameworks are very similar.

现在,它们有什么不同吗?是的.首先,通过将更多手机功能桥接到 javascript,Titanium 似乎比 PhoneGap 功能更丰富.最值得注意的是,PhoneGap 没有向 javascript 公开许多(如果有的话)本机 UI 组件.另一方面,Titanium 拥有全面的 UI API,可以在 javascript 中调用这些 API 来创建和控制各种原生 UI 控件.利用这些 UI API,Titanium 应用程序看起来比 PhoneGap 应用程序更原生".其次,PhoneGap 比 Titanium 支持更多的手机平台.PhoneGap API 更通用,可用于不同平台,如 iPhone、Android、Blackberry、Symbian 等. Titanium 至少目前主要针对 iPhone 和 Android.它的一些 API 是特定于平台的(如 iPhone UI API).使用这些 API 会降低应用的跨平台能力.

Now, are they any different? Yes. First, Titanium appears to be more feature rich than PhoneGap by bridging more mobile phone functions to javascript. Most noticeably, PhoneGap does not expose many (if any) native UI components to javascript. Titanium, on the other hand, has a comprehensive UI APIs that can be called in javascript to create and control all kinds of native UI controls. Utilizaing these UI APIs, a Titanium app can look more "native" than a PhoneGap app. Second, PhoneGap supports more mobile phone platforms than Titanium does. PhoneGap APIs are more generic and can be used on different platforms such as iPhone, Android, Blackberry, Symbian, etc. Titanium is primarily targeting iPhone and Android at least for now. Some of its APIs are platform specific (like the iPhone UI APIs). The use of these APIs will reduce the cross-platform capability of your application.

因此,如果您希望应用程序看起来更原生",Titanium 是更好的选择.如果您希望能够更轻松地将您的应用移植"到另一个平台,PhoneGap 会更好.

So, if your concern for your app is to make it more "native" looking, Titanium is a better choice. If you want to be able to "port" your app to another platform more easily, PhoneGap will be better.

2010 年 8 月 13 日更新:链接到Titanium 员工对米奇问题的回答.

2010 年 4 月 12 日更新:我决定对这篇文章进行年度审查,以使其信息保持最新.许多事情在一年中发生了变化,导致最初帖子中的一些信息已经过时.

Updated 12/04/2010: I decided to give this post an annual review to keep its information current. Many things have changes in a year that made some of the information in the initial post outdated.

最大的变化来自钛.今年早些时候,Appcelerator 发布了 Titanium 1.0,从架构的角度来看,它与之前的版本大相径庭.在 1.0 中,不再使用 UIWebView 控件.相反,您可以为任何 UI 函数调用 Titanium API.这一变化意味着几件事:

The biggest change came from Titanium. Earlier this year, Appcelerator released Titanium 1.0, which departed drastically from its previous versions from the architectural standpoint. In 1.0, the UIWebView control is no longer in use. Instead, you call Titanium APIs for any UI functions. This change means a couple things:

  1. 您的应用 UI 变得完全原生.您的应用程序中不再有 Web UI,因为原生 Titanium API 接管了您所有 UI 需求的控制.Titanium 在跨平台原生 UI"前沿领域的开拓值得称赞.它为喜欢本机 UI 的外观和感觉但不喜欢官方编程语言的程序员提供了替代方案.

  1. Your app UI becomes completely native. There is no more web UI in your app since the native Titanium APIs take over control of all your UI needs. Titanium deserves a lot of credit by pioneering on the "Cross-Platform Native UI" frontier. It gives programmers who prefer the look and feel of native UI but dislike the official programming language an alternative.

您将无法在您的应用中使用 HTML 或 CSS,因为网络视图已经消失.(注意:您仍然可以在 Titanium 中创建 Web 视图.但是在 Web 视图中可以利用的 Titanium 功能很少.)Titanium 问答:HTML & 发生了什么CSS?

You won't be able to use HTML or CSS in your app, as the web view is gone. (Note: you can still create web view in Titanium. But there are few Titanium features that you can take advantage of in the web view.)Titanium Q&A: What happened to HTML & CSS?

您将无法使用假设 DOM 对象存在的流行 JS 库,例如 JQuery.您继续使用 JavaScript 作为您的编码语言.但这几乎是作为 Web 程序员使用 Titanium 1.0 的唯一可以使用的 Web 技术.

You won't be able to use popular JS libraries such as JQuery that assume the existence of an DOM object. You continue to use JavaScript as your coding language. But that is pretty much the only web technology you can utilize if you come to Titanium 1.0 as a web programmer.

Titanium 视频:Titanium 1.0 中的新功能.

现在,Titanium 1.0 是否会将您的 JavaScript 编译为本机位"?不.Appcelerator 终于通过这个开发者博客解决了这个问题:Titanium 指南项目:JS 环境. 我们程序员比市场部的那些人更真诚,不是吗?:-)

Now, does Titanium 1.0 compile your JavaScript into "native bits"? No. Appcelerator finally came clean on this issue with this developer blog:Titanium Guides Project: JS Environment. We programmers are more genuine people than those in the Marketing department, aren't we? :-)

转到PhoneGap.关于PhoneGap,没有多少新东西可说.我的看法是,直到今年晚些时候 IBM 加入之后,PhoneGap 的开发才非常活跃.有些人甚至认为 IBM 为 PhoneGap 贡献的代码比 Nitobi 多.无论是否属实,很高兴知道 PhoneGap 正在积极开发中.

Move on to PhoneGap. There are not many new things to say about PhoneGap. My perception is that PhoneGap development was not very active until IBM jumped on board later this year. Some people even argued that IBM is contributing more code to PhoneGap than Nitobi is. That being true or not, it is good to know that PhoneGap is being active developed.

PhoneGap 继续以网络技术为基础,即 HTML、CSS 和 JavaScript.看起来 PhoneGap 没有任何计划像 Titanium 那样将原生 UI 功能桥接到 JavaScript.虽然 Web UI 在性能和原生外观方面仍然落后于原生 UI,但这种差距正在迅速缩小.网络技术有两个趋势可以确保移动网络用户界面在性能方面的亮点:

PhoneGap continues to base itself on web technologies, namely HTML, CSS and JavaScript. It does not look like PhoneGap has any plan to bridge native UI features to JavaScript as Titanium is doing. While Web UI still lags behind native UI on performance and native look and feel, such gap is being rapidly closed. There are two trends in web technologies that ensure bright feature to mobile web UI in terms of performance:

  1. JavaScript 引擎从解释器转变为虚拟机.JavaScript 被 JIT 编译成本机代码以加快执行速度.Safari JS 引擎:SquirrelFish Extreme

网页渲染从依赖 CPU 转向使用 GPU 加速.在硬件加速的帮助下,诸如页面过渡和 3D 动画等图形密集型任务变得更加流畅.Chrome 中的 GPU 加速合成

Web page rendering moving from relying on CPU to using GPU acceleration. Graphic intensive tasks such as page transition and 3D animation become a lot smoother with the help of hardware acceleration. GPU Accelerated Compositing in Chrome

源自桌面浏览器的此类改进正在迅速交付给移动浏览器.事实上,从 iOS 3.2 和 Android 2.0 开始,移动 Web 视图控件的性能和 HTML5 变得更加友好.移动网络的未来充满希望,以至于吸引了一个大孩子:JQuery 最近宣布了其移动网络框架. JQuery Mobile 提供 UI 小工具,PhoneGap 提供电话功能,在我看来,这两者结合起来创造了一个完美的移动网络平台.

Such improvements that are originated from desktop browsers are being delivered to mobile browsers quickly. In fact, since iOS 3.2 and Android 2.0, the mobile web view control has become much more performing and HTML5 friendly. The future of mobile web is so promising that it has attracted a big kid to town: JQuery has recently announced its mobile web framework. With JQuery Mobile providing UI gadgets, and PhoneGap providing phone features, they two combined creates a perfect mobile web platform in my opinion.

我还应该提到 Sencha Touch 作为另一个移动网络 UI 小工具框架.Sencha Touch 1.0 版最近在包含 GPLv3 的双重许可模式下发布.Sencha Touch 与 PhoneGap 配合得很好,就像 JQuery Mobile 一样.

I should also mention Sencha Touch as another mobile web UI gadget framework. Sencha Touch version 1.0 was recently released under a dual licensing model that includes GPLv3. Sencha Touch works well with PhoneGap just as JQuery Mobile does.

如果您是 GWT 程序员(和我一样),您可能需要检查一下GWT Mobile,这是一个使用 GWT 创建移动网络应用程序的开源项目.它包括一个 PhoneGap GWT 包装器,可以在 GWT 中使用 PhoneGap.

If you are a GWT programmer(like me), you may want to check out GWT Mobile, an open source project for creating mobile web apps with GWT. It includes a PhoneGap GWT wrapper that enables the use of PhoneGap in GWT.

这篇关于Corona、Phonegap、Titanium的比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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