电晕,Phonegap,钛之间的比较 [英] Comparison between Corona, Phonegap, Titanium

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

问题描述

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



I知道有一些技术可以让你使用HTML,CSS和Javascript开发原生iPhone应用程序。我已经确定了几个: Ansca Mobile

  • PhoneGap

  • Appcelerator



  • 还有其他类似的产品吗?他们之间有什么不同?我应该选择哪一种?

    解决方案

    我使用了stackoverflow进行注册,仅仅是为了评论大多数投票答案。不好的一点是,stackoverflow不允许新成员发表评论。所以我必须让这个评论看起来更像一个答案。



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


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

    2. 不要将你的html,css或javascript代码编译成本地位。它们被打包为可执行文件包的资源,非常类似于嵌入式图像文件。当应用程序运行时,这些资源被加载到一个UIWebView控件中并在那里运行(当然,就是javascript,而不是本地位)。 JavaScript-to-native-code(或to-objective-c)编译器没有这样的东西。这在PhoneGap中也是这样做的。从架构的角度来看,这两个框架非常相似。


    现在,他们有什么不同吗?是。首先,Titanium似乎比PhoneGap功能更丰富,它将更多手机功能与JavaScript结合起来。最明显的是,PhoneGap不会将很多(如果有的话)本机UI组件暴露给javascript。另一方面,Titanium具有全面的UI API,可以在JavaScript中调用它来创建和控制各种本机UI控件。利用这些UI API,Titanium应用程序看起来比PhoneGap应用程序更原生。其次,PhoneGap比Titanium支持更多的手机平台。 PhoneGap API更通用,可用于iPhone,Android,Blackberry,Symbian等不同平台。钛至少主要针对iPhone和Android。它的一些API是平台特定的(如iPhone UI API)。使用这些API会降低应用程序的跨平台功能。因此,如果您对您的应用程序的关注是为了让它更加本土化,Titanium是一个更好的选择。如果您希望能够更轻松地将您的应用移植到另一个平台,PhoneGap会更好。

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



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


    Titanium最大的变化来自于Titanium。今年早些时候,Appcelerator发布了Titanium 1.0,从架构角度来看,它离开了之前的版本。在1.0中,UIWebView控件不再被使用。相反,您可以为任何UI功能调用Titanium API。这种变化意味着一些东西:


    1. 您的应用用户界面变得完全原生。由于本机Titanium API接管了所有UI需求,因此您的应用中不再需要Web UI。钛在跨平台本地用户界面领域开创先河,值得信赖。它给程序员更喜欢本地UI的外观和感觉,但不喜欢官方编程语言。 您的应用中无法使用HTML或CSS,因为网页视图不见了。 (注意:您仍然可以在Titanium中创建Web视图,但是您可以在Web视图中利用很少的Titanium功能。)


    2. 您将无法使用流行的JS库(如JQuery)假设存在DOM对象。您继续使用JavaScript作为您的编码语言。但是,如果您作为网络​​程序员来到Titanium 1.0,那么您几乎可以使用这种技术。


    Titanium视频:Titanium 1.0中的新功能



    <现在,Titanium 1.0是否将JavaScript编译为本地位?没有。Appcelerator终于在这个开发者博客中解决了这个问题: Titanium Guides Project:JS Environment。我们的程序员比市场部门的人更真实,不是吗? :-)



    转到PhoneGap。关于PhoneGap没有太多新东西要说。我的理解是PhoneGap的发展在今年晚些时候IBM跳槽之前并不是非常活跃。有些人甚至认为IBM为PhoneGap贡献了比Nitobi更多的代码。这是真的,不是真的,知道PhoneGap正在积极开发。

    PhoneGap继续以Web技术为基础,即HTML,CSS和JavaScript。看起来PhoneGap并没有计划将原生UI功能与JavaScript结合起来,正如Titanium所做的那样。尽管Web UI在性能和原生外观方面仍落后于原生UI,但这种差距正在迅速关闭。 Web技术有两种趋势确保移动Web UI在性能方面具有明显的特征:


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


    2. 网页渲染从依靠CPU转向使用GPU加速。借助硬件加速,图形密集型任务(如页面转换和3D动画)变得更加平滑。 Chrome中的GPU加速合成 b


      这些源自桌面浏览器的改进功能正在迅速提供给移动浏览器。事实上,自从iOS 3.2和Android 2.0以来,移动网页视图控件已经变得更加完善并且对HTML5友好。移动网络的未来非常有希望,它吸引了一个大城市: JQuery最近宣布了它的移动网络框架。使用JQuery Mobile提供的用户界面小工具和PhoneGap提供的手机功能,他们两者的结合创造了一个完美的移动网络平台,在我看来。



      我还应该提到 Sencha Touch 作为另一个移动Web UI小工具框架。 Sencha Touch版本1.0最近在包含GPLv3的双重许可模式下发布。 Sencha Touch与PhoneGap的效果一样,就像JQuery Mobile一样。



      如果您是 GWT 程序员(像我一样),你可能想看看 GWT Mobile ,一个用GWT创建移动网络应用程序的开源项目。它包含一个PhoneGap GWT包装器,可以在GWT中使用PhoneGap。

      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.

      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?

      解决方案

      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'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 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.

      2. 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.

      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.

      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.

      Updated 8/13/2010: Link to a Titanium employee's answer to Mickey's question.

      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.

      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. 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.

      2. 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?

      3. 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 video: What is new in Titanium 1.0.

      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? :-)

      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 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 engine moving from an interpreter to a virtual machine. JavaScript is JIT compiled into native code for faster execution. Safari JS engine: SquirrelFish Extreme

      2. 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

      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.

      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.

      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.

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

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