Android Corona、Phonegap、Titanium的比较
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1482586/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Comparison between Corona, Phonegap, Titanium
提问by Mickey Shine
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.
我是一名网络开发人员,我想将我的网络产品转移到 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:
我知道有一些技术可以让您使用 HTML、CSS 和 Javascript 来开发本机 iPhone 应用程序。我已经确定了一些:
Are there other, similar products? What are the differences between them? Which should I choose?
还有其他类似的产品吗?它们之间有什么区别?我应该选择哪个?
回答by DennisJZH
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.
我注册 stackoverflow 只是为了评论最上面的投票答案。不好的是 stackoverflow 不允许新成员发表评论。所以我必须让这个评论看起来更像一个答案。
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.
Rory Blyth 的回答包含关于这两个 javascript 移动框架的一些有效观点。然而,他的关键点是不正确的。事实是,Titanium 和 PhoneGap 相似多于不同。它们都通过一组 javascript API 公开手机功能,并且应用程序的逻辑(html、css、javascript)运行在本机 WebView 控件中。
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 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.
PhoneGap 不仅仅是 Web 应用程序的本机包装器。通过PhoneGap javascript API,“网络应用程序”可以访问手机功能,如地理定位、加速度计相机、联系人、数据库、文件系统等。基本上手机SDK提供的任何功能都可以“桥接”到javascript 世界。另一方面,运行在移动 Web 浏览器上的普通 Web 应用程序无法访问大多数这些功能(安全是主要原因)。因此,PhoneGap 应用程序更像是一个移动应用程序,而不是一个网络应用程序。您当然可以使用 PhoneGap 来包装一个根本不使用任何 PhoneGap API 的 Web 应用程序,但这不是 PhoneGap 的创建目的。
Titanium 不会将您的 html、css 或 javascript 代码编译为“本机位”。它们被打包为可执行包的资源,很像嵌入的图像文件。当应用程序运行时,这些资源被加载到 UIWebView 控件中并在那里运行(当然,作为 javascript,而不是本机位)。没有 javascript-to-native-code(或 to-objective-c)编译器这样的东西。这在 PhoneGap 中也是以同样的方式完成的。从架构的角度来看,这两个框架非常相似。
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.
现在,它们有什么不同吗?是的。首先,通过将更多手机功能桥接到 javascript,Titanium 似乎比 PhoneGap 功能更丰富。最值得注意的是,PhoneGap 没有向 javascript 公开许多(如果有的话)本机 UI 组件。另一方面,Titanium 拥有全面的 UI API,可以在 javascript 中调用这些 API 来创建和控制各种原生 UI 控件。利用这些 UI API,Titanium 应用程序看起来比 PhoneGap 应用程序更“原生”。其次,PhoneGap 比 Titanium 支持更多的手机平台。PhoneGap API 更通用,可用于不同平台,如 iPhone、Android、黑莓、Symbian 等。 Titanium 至少目前主要针对 iPhone 和 Android。它的一些 API 是特定于平台的(如 iPhone UI API)。
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.
因此,如果您希望应用程序看起来更“原生”,那么 Titanium 是更好的选择。如果您希望能够更轻松地将您的应用“移植”到另一个平台,PhoneGap 会更好。
Updated 8/13/2010:Link to a Titanium employee's answer to Mickey's question.
2010 年 8 月 13 日更新:链接到 Titanium 员工对 Mickey 问题的回答。
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.
2010 年 4 月 12 日更新:我决定对这篇文章进行年度,以使其信息保持最新。许多事情在一年中发生了变化,导致最初帖子中的一些信息已经过时。
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:
最大的变化来自钛。今年早些时候,Appcelerator 发布了 Titanium 1.0,从架构的角度来看,它与之前的版本大相径庭。在 1.0 中,不再使用 UIWebView 控件。相反,您可以为任何 UI 函数调用 Titanium API。这种变化意味着几件事:
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.
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?
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.
您的应用程序 UI 变得完全原生。您的应用程序中不再有 Web UI,因为原生 Titanium API 接管了您所有 UI 需求的控制。Titanium 在“跨平台原生 UI”前沿领域的开拓值得称赞。它为喜欢本机 UI 的外观和感觉但不喜欢官方编程语言的程序员提供了另一种选择。
您将无法在您的应用程序中使用 HTML 或 CSS,因为 Web 视图已经消失。(注意:您仍然可以在 Titanium 中创建 Web 视图。但是在 Web 视图中可以利用的 Titanium 功能很少。)Titanium Q&A:HTML 和 CSS 发生了什么变化?
您将无法使用假设 DOM 对象存在的流行 JS 库,例如 JQuery。您继续使用 JavaScript 作为您的编码语言。但这几乎是您作为 Web 程序员使用 Titanium 1.0 时可以使用的唯一 Web 技术。
Titanium video: What is new in Titanium 1.0.
Titanium 视频: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? :-)
现在,Titanium 1.0 是否会将您的 JavaScript 编译为“本机位”?不。Appcelerator 终于通过这个开发者博客解决了这个问题:Titanium Guides Project: JS Environment。我们程序员比市场部的人更真诚,不是吗?:-)
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。关于PhoneGap,没有多少新东西可说。我的看法是,直到今年晚些时候 IBM 加入之后,PhoneGap 的开发才非常活跃。有些人甚至认为 IBM 为 PhoneGap 贡献的代码比 Nitobi 多。不管是真是假,很高兴知道 PhoneGap 正在积极开发中。
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:
PhoneGap 继续以 Web 技术为基础,即 HTML、CSS 和 JavaScript。看起来 PhoneGap 没有任何计划像 Titanium 那样将原生 UI 功能桥接到 JavaScript。虽然 Web UI 在性能和原生外观方面仍然落后于原生 UI,但这种差距正在迅速缩小。Web 技术有两个趋势可以确保移动 Web UI 在性能方面的亮点:
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
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
JavaScript 引擎从解释器转变为虚拟机。JavaScript 被 JIT 编译成本机代码以加快执行速度。Safari JS 引擎:SquirrelFish Extreme
网页渲染从依赖 CPU 转向使用 GPU 加速。在硬件加速的帮助下,诸如页面过渡和 3D 动画等图形密集型任务变得更加流畅。Chrome 中的 GPU 加速合成
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.
这种源自桌面浏览器的改进正在迅速交付给移动浏览器。实际上,从 iOS 3.2 和 Android 2.0 开始,移动 Web 视图控件的性能和 HTML5 变得更加友好。移动网络的未来充满希望,以至于吸引了一个大孩子:JQuery 最近宣布了它的移动网络框架。JQuery Mobile 提供 UI 小工具,PhoneGap 提供电话功能,在我看来,这两者结合起来创造了一个完美的移动网络平台。
I should also mention Sencha Touchas 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.
我还应该提到Sencha Touch作为另一个移动 Web UI 小工具框架。Sencha Touch 1.0 版最近在包含 GPLv3 的双重许可模式下发布。Sencha Touch 与 PhoneGap 配合得很好,就像 JQuery Mobile 一样。
If you are a GWTprogrammer(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.
如果您是GWT程序员(像我一样),您可能想查看GWT Mobile,这是一个使用 GWT 创建移动 Web 应用程序的开源项目。它包括一个 PhoneGap GWT 包装器,可以在 GWT 中使用 PhoneGap。
回答by Rory Blyth
From what I've gathered, here are some differences between the two:
根据我收集的信息,以下是两者之间的一些差异:
PhoneGap basically generates native wrappers for what are still web apps. It spits out a WhateverYourPlatformIs project, you build it, and deploy. If we're talking about the iPhone (which is where I spend my time), it doesn't seem much different from creating a web app launcher (a shortcut that gets its own Springboard icon, so you can launch it like (like) a native app). The "app" itself is still html/js/etc., and runs inside a hosted browser control. What PhoneGap provides beyond that is a bridge between JavaScript and native device APIs. So, you write JavaScript against PhoneGap APIs, and PhoneGap then makes the appropriate corresponding native call. In that respect, it isdifferent from deploying a plain old web app.
Titanium source gets compiled down to native bits. That is, your html/js/etc. aren't simply attached to a project and then hosted inside a web browser control - they're turned into native apps. That means, for example, that your app's interface will be composed of nativeUI components. There are ways of getting native look-and-feel without having a native app, but... well... what a nightmare that usually turns out to be.
PhoneGap 基本上为仍然是Web 应用程序的内容生成本机包装器。它会输出一个 WhatYourPlatformIs 项目,您可以构建它并进行部署。如果我们谈论的是 iPhone(这是我花时间的地方),它似乎与创建 Web 应用程序启动器(具有自己的 Springboard 图标的快捷方式,因此您可以像(例如)一样启动它)没有太大区别本机应用程序)。“应用程序”本身仍然是 html/js/etc.,并在托管浏览器控件内运行。除此之外,PhoneGap 还提供了 JavaScript 和本机设备 API 之间的桥梁。因此,您针对 PhoneGap API 编写 JavaScript,然后 PhoneGap 进行相应的本地调用。在这方面,它是从部署一个普通的旧的Web应用程序不同。
Titanium 源代码被编译为原生位。也就是说,你的 html/js/etc. 不是简单地附加到项目然后托管在 Web 浏览器控件中 - 它们变成了本机应用程序。这意味着,例如,您的应用程序的界面将由本机UI 组件组成。有很多方法可以在没有本机应用程序的情况下获得本机外观,但是......好吧......通常结果是一场噩梦。
The two are similar in that you write all your stuff using typical web technologies (html/js/css/blah blah blah), and that you get access to native functionality through custom JavaScript APIs.
两者的相似之处在于您使用典型的 Web 技术(html/js/css/blah blah blah)编写所有内容,并且您可以通过自定义 JavaScript API 访问本机功能。
But, again, PhoneGap apps (PhonGapps? I don't know... is that a stupid name? It's easier to say - I know that much) start their lives as web apps and end their lives as web apps. On the iPhone, your html/js/etc. is just executed inside a UIWebView control, and the PhoneGap JavaScript APIs your js calls are routed to native APIs.
但是,再一次,PhoneGap 应用程序(PhonGapps?我不知道......这是一个愚蠢的名字吗?说起来更容易 - 我知道这么多)以网络应用程序开始他们的生活,并以网络应用程序结束他们的生活。在 iPhone 上,你的 html/js/etc. 只是在 UIWebView 控件内执行,并且您的 js 调用的 PhoneGap JavaScript API 被路由到本机 API。
Titanium apps become native apps - they're just developed using web dev tech.
Titanium 应用程序成为本机应用程序 - 它们只是使用网络开发技术开发的。
What does this actually mean?
这实际上意味着什么?
A Titanium app will looklike a "real" app because, ultimately, it isa "real" app.
A PhoneGap app will look like a web app being hosted in a browser control because, ultimately, it isa web app being hosted in a browser control.
Titanium 应用程序看起来像一个“真正的”应用程序,因为最终它是一个“真正的”应用程序。
PhoneGap 应用程序看起来像托管在浏览器控件中的 Web 应用程序,因为归根结底,它是托管在浏览器控件中的 Web 应用程序。
Which is right for you?
哪个适合你?
If you want to write native apps using web dev skills, Titanium is your best bet.
If you want to write an app using web dev skills that you could realistically deploy to multiple platforms (iPhone, Android, Blackberry, and whatever else they decide to include), and if you want access to a subset of native platform features (GPS, accelerometer, etc.) through a unified JavaScript API, PhoneGap is probably what you want.
如果您想使用 Web 开发技能编写本机应用程序,Titanium 是您的最佳选择。
如果您想使用可以实际部署到多个平台(iPhone、Android、Blackberry 以及他们决定包括的任何其他平台)的 Web 开发技能编写应用程序,并且如果您想访问本机平台功能的子集(GPS、加速度计等)通过统一的 JavaScript API,PhoneGap 可能就是你想要的。
You might be asking: Why would I want to write a PhoneGapp (I've decided to use the name) rather than a web app that's hosted on the web? Can't I still access some native device features that way, but also have the convenience of true web deployment rather than forcing the user to download my "native" app and install it?
您可能会问:为什么我要编写 PhoneGapp(我决定使用该名称)而不是托管在 Web 上的 Web 应用程序?难道我仍然不能以这种方式访问某些本机设备功能,而且还可以享受真正的 Web 部署的便利,而不是强迫用户下载我的“本机”应用程序并安装它?
The answer is: Because you can submit your PhoneGapp to the App Store and charge for it. You also get that launcher icon, which makes it harder for the user to forget about your app (I'm far more likely to forget about a bookmark than an app icon).
答案是:因为你可以将你的PhoneGapp提交到App Store并收费。你还会得到那个启动器图标,这让用户更难忘记你的应用程序(我更容易忘记书签而不是应用程序图标)。
You could certainly charge for access to your web-hosted web app, but how many people are really going to go through the process to do that? With the App Store, I pick an app, tap the "Buy" button, enter a password, and I'm done. It installs. Seconds later, I'm using it. If I had to use someone else's one-off mobile web transaction interface, which likely means having to tap out my name, address, phone number, CC number, and other things I don't want to tap out, I almost certainly wouldn't go through with it. Also, I trust Apple - I'm confident Steve Jobs isn't going to log my info and then charge a bunch of naughty magazine subscriptions to my CC for kicks.
您当然可以为访问您的网络托管网络应用程序收费,但有多少人真的会通过这个过程来做到这一点?在 App Store 中,我选择一个应用程序,点击“购买”按钮,输入密码,我就完成了。它安装。几秒钟后,我正在使用它。如果我不得不使用别人的一次性移动网络交易界面,这可能意味着必须敲出我的姓名、地址、电话号码、抄送号码和其他我不想敲出的东西,我几乎肯定不会不去解决它。另外,我相信苹果——我相信史蒂夫乔布斯不会记录我的信息,然后向我的 CC 收取一堆顽皮的杂志订阅费。
Anyway, except for the fact that web dev tech is involved, PhoneGap and Titanium are very different - to the point of being only superficially comparable.
无论如何,除了涉及 Web 开发技术这一事实之外,PhoneGap 和 Titanium 非常不同 - 仅在表面上具有可比性。
I hate web apps, by the by, and if you read iTunes App Store reviews, users are pretty good at spotting them. I won't name any names, but I have a couple "apps" on my phone that look and run like garbage, and it's because they're web apps that are hosted inside UIWebView instances. If I wanted to use a web app, I'd open Safari and, you know, navigate to one. I bought an iPhone because I want things that are iPhone-y. I have no problem using, say, a snazzy Google web app inside Safari, but I'd feel cheated if Google just snuck a bookmark onto Springboard by presenting a web app as a native one.
我讨厌网络应用程序,顺便说一句,如果你阅读 iTunes App Store 的评论,用户很擅长发现它们。我不会说出任何名字,但我的手机上有几个“应用程序”,它们看起来和运行起来都像垃圾,这是因为它们是托管在 UIWebView 实例中的 Web 应用程序。如果我想使用网络应用程序,我会打开 Safari,然后导航到其中一个。我买了 iPhone 是因为我想要 iPhone-y 的东西。例如,我在 Safari 中使用一个时髦的 Google 网络应用程序没有问题,但如果 Google 只是通过将网络应用程序作为本机应用程序呈现,而将书签偷偷放在 Springboard 上,我会觉得被欺骗了。
Have to go now. My girlfriend has that could-you-please-stop-using-that-computer-for-three-seconds look on her face.
要离开了。我女朋友的脸上有那种你能不能停止使用那台电脑三秒钟的表情。
回答by user288299
I'm taking a course in Android/iPhone development and we spent 8 weeks with Titanium (not full time) (Version was Titanium 1.4.2 and time was around November 2010). Here is my experience.
我正在学习 Android/iPhone 开发课程,我们在 Titanium 上花了 8 周时间(不是全职)(版本是 Titanium 1.4.2,时间是 2010 年 11 月左右)。这是我的经验。
iPhone Android dual targetting
iPhone Android 双重定位
Even though the API guides claim that the functionality is available for both the Android and iPhone, this is not the case. Much of the stuff simply don't work on one of the platforms. Some things works differently.
尽管 API 指南声称该功能可用于 Android 和 iPhone,但事实并非如此。许多东西根本无法在其中一个平台上运行。有些事情的运作方式不同。
A lot of the people in the class has done iPhone applications, and they can not make them work on Android without major rewrites. I developed a simple childrens app called Animap (see android market / Appstore in Sweden) and started developing under Windows. Once the Android target was working I opened the project on OS X. It does not show any build stuff for iPhone, just for Android. You need to start a dual target project under OS X. (Ok, I copied the relevant files to a new project). Next problem - the animations does not work on iPhone (they work on Android). The scrolling events does not work the same on the iPhone. (i.e on Android you get the untouch event when user stops scrolling and releases their finger from the screen, this does not happen on the iPhone).
班上的很多人都做过 iPhone 应用程序,如果没有大的重写,他们无法让它们在 Android 上运行。我开发了一个简单的儿童应用程序,称为 Animap(参见瑞典的 android 市场/Appstore)并开始在 Windows 下开发。一旦 Android 目标开始工作,我就在 OS X 上打开了该项目。它没有显示任何适用于 iPhone 的构建内容,仅适用于 Android。你需要在OS X下启动一个双目标项目。(好吧,我把相关文件复制到一个新项目中)。下一个问题 - 动画在 iPhone 上不起作用(它们在 Android 上工作)。滚动事件在 iPhone 上的工作方式不同。(即在 Android 上,当用户停止滚动并从屏幕上松开手指时,您会收到 untouch 事件,这在 iPhone 上不会发生)。
Since this is not mentioned somewhere you basicly need to do trial and error programming on first one platform, then on the other platform. By trial and error I mean it will take about two days to get such a simple App as Animap working on the other platform. You will also need to have if (android) then... or if(iphone)... all over your code...
由于在某处没有提到这一点,因此您基本上需要在第一个平台上进行试错编程,然后在另一个平台上进行。通过反复试验,我的意思是大约需要两天时间才能获得像 Animap 这样简单的应用程序在另一个平台上工作。您还需要在代码中使用 if (android) then... 或 if(iphone)...
Download and setup
下载和设置
You must follow the instructions to the letter. Do not try to use java 64 bit. It will not compile the KitchenSink 1.4.0 demo application. (1.3 works OK!) You must put files directly on the C drive as long pathnames will make the external program not receiving all command line parameters if they get to long. (Fine for small programs though) 1/3 of the times, the toolchain simply stops and you must press 'launch' again. Then it will probably work... very unreliable. The simulator will not be found on startup and then you must simply kill of adb.exe with Ctrl+Alt+Delete and retry.
您必须按照信函中的说明进行操作。不要尝试使用 java 64 位。它不会编译 KitchenSink 1.4.0 演示应用程序。(1.3 工作正常!)您必须将文件直接放在 C 驱动器上,因为长路径名会使外部程序无法接收所有命令行参数,如果它们变长。(不过对于小程序来说很好)1/3 的时候,工具链只是停止,您必须再次按“启动”。那么它可能会工作......非常不可靠。在启动时将找不到模拟器,然后您必须简单地使用 Ctrl+Alt+Delete 杀死 adb.exe 并重试。
Network connection
网络连接
On a wifi-network you sometimes looses the live connection and Titanium crashes on you (the compile/deploy interface) If you do not have a working internet connection it will not start as it can not log you in to their servers.
在 wifi 网络上,您有时会失去实时连接,并且 Titanium 在您身上崩溃(编译/部署界面)如果您没有可用的互联网连接,它将无法启动,因为它无法让您登录到他们的服务器。
API
应用程序接口
CSS, HTML and jQuery is a breeze compared to this. Titanium resembles any other old GUI API, and you need to set some properties for every single button/field/etc. Getting a field wrong is just to easy, remembering all the properties that needs to be set? Did you spell it with capital letters at the right place? (as this is not caught by the compiler, but will be seen as a runtime error if you are lucky to test that part)
与此相比,CSS、HTML 和 jQuery 轻而易举。Titanium 类似于任何其他旧的 GUI API,您需要为每个按钮/字段/等设置一些属性。让一个字段出错很容易,记住所有需要设置的属性?你在正确的地方用大写字母拼写了吗?(因为这不会被编译器捕获,但如果您幸运地测试了该部分,则会被视为运行时错误)
In Titanium things simply break when you add another view on top of a control or click somewhere else in the GUI.
在 Titanium 中,当您在控件顶部添加另一个视图或单击 GUI 中的其他位置时,事情就会简单地中断。
Documentation
文档
Several API pages carry the Android symbol, but will only return a null when you try to create the control. They are not simply available on the Android platform despite the symbols. Sometimes Android is mention to not support a particular method, but then the whole API is missing.
一些 API 页面带有 Android 符号,但只会在您尝试创建控件时返回 null。尽管有符号,但它们并不仅仅在 Android 平台上可用。有时会提到 Android 不支持特定方法,但随后缺少整个 API。
KitchenSink
厨房水槽
The demo application. Did I mention it does not compile if you put it in your Eclipse project folder because the path gets too long? Must be put on your C drive in the root folder. I currently use a symbolik link (mklink /J ...)
演示应用程序。我有没有提到如果你把它放在你的 Eclipse 项目文件夹中它不会编译,因为路径太长?必须放在你的C盘根文件夹中。我目前使用符号链接(mklink / J ...)
Undocumented methods
未记录的方法
You must propably use things as label.setText('Hello World') to change a label reliable but this is not documented at all.
您必须适当地将事物用作 label.setText('Hello World') 来更改可靠的标签,但这根本没有记录。
Debugging
调试
Titanium.API.info('Printouts are the only way to debug');
Titanium.API.info('打印输出是唯一的调试方式');
Editing
编辑
The APIs are not available in any good format so you can not get ordinary code-completion with help etc. in Eclipse. Aptana please help out!
这些 API 没有任何好的格式,因此您无法在 Eclipse 中通过帮助等获得普通的代码完成。Aptana 请帮忙!
Hardware
硬件
It seems that the compiler/tools are not multithreaded so a fast computer with a fast harddrive is a must, as you must do a lot of trial & error. Did I mention the poor documentation? You must try out everything there as you can't trust it!
似乎编译器/工具不是多线程的,因此必须使用具有快速硬盘驱动器的快速计算机,因为您必须进行大量反复试验。我有没有提到糟糕的文档?你必须尝试那里的一切,因为你不能相信它!
Some positive things
一些积极的事情
- Open Source
From previous projects I have promised myself never ever to use closed source again as you can't simply fix things just by throwing hours and manpower at it. Important when you are late in the project and need to deliver for a hard deadline. This is open source and I have been able to see why the tool chain breaks and actually fix it as well.
Bugdatabase
It's also open. You can simply see that your not alone and do a workaround instead of another 4 hours spent on trial&error.
Community
- Seems to be active on their forums.
- 开源
在之前的项目中,我向自己保证永远不会再使用闭源,因为你不能仅仅通过投入时间和人力来解决问题。当您在项目中迟到并需要在严格的期限内交付时,这一点很重要。这是开源的,我已经能够看到为什么工具链会中断并实际修复它。
错误数据库
它也是开放的。您可以简单地看到您并不孤单并采取解决方法,而不是再花费 4 个小时进行反复试验。
社区
- 似乎在他们的论坛上很活跃。
Bugs
错误
- Titanium 1.4 is not threadsafe. That means if you make use of threads (use the url: property in a createWindow call) and program like the threads are working and send events with data back and forth you run into a lot of very, very strange stuff - lost handlers, lost windows, too many events, too few events, etc. etc. This is all dependent on the timing, putting the rows of code in different order might crash or heal your application. Adding a window in another file.js breaks your app.js execution... This also trashes internal datastructures in Titanium, as they sometimes can update internal datastructures in paralell, overwriting a just changed value with something else.
- Titanium 1.4 不是线程安全的。这意味着如果你使用线程(在 createWindow 调用中使用 url: 属性)和程序就像线程正在工作并来回发送带有数据的事件,你会遇到很多非常非常奇怪的事情 - 丢失的处理程序,丢失窗口、事件太多、事件太少等等。这都取决于时间,将代码行放在不同的顺序可能会崩溃或修复您的应用程序。在另一个文件中添加一个窗口。
Much of the problems I have had with Titanium comes from my background on realtime systems like OSE who support hundreds of threads, events and message passing. This is supposed to work in Titanium 1.4 but it simply doesn't do it reliably.
我在使用 Titanium 时遇到的许多问题都来自我在实时系统(如 OSE)方面的背景,这些系统支持数百个线程、事件和消息传递。这应该在 Titanium 1.4 中工作,但它根本不可靠。
Javascript (which is new to me) dies silently on runtime errors. This also means that small and common bugs, like misspelling a variable name or reading in a null-pointer does not crash when it should so you can debug it. Instead parts of your program just stop working, for instance an eventhandler, because you misplaced/misstyped a character.
Then we have more simple bugs in Titanium, like some parameters not working in the functions (which is quite common on the Android platform at least).
Trial and Error debug cycle speed Having run Titnium Developer on several computers, I noticed that the bottleneck is the harddrive. An SSD drive on a laptop makes the build cycle about 3-5 times faster than on a 4200 rpm drive. On a desktop, having dual drives in RAID 1 (striping mode) makes the build about 25 percent faster than on a single drive with a somewhat faster CPU and it also beats the SSD drive laptop.
Javascript(这对我来说是新的)会在运行时错误时悄无声息地消失。这也意味着小的和常见的错误,例如拼写错误的变量名称或读取空指针,不会在应该崩溃时崩溃,因此您可以对其进行调试。相反,您的程序的某些部分只是停止工作,例如事件处理程序,因为您放错了/打错了一个字符。
然后我们在 Titanium 中还有更多简单的错误,比如一些参数在函数中不起作用(至少在 Android 平台上很常见)。
试错调试周期速度 在多台计算机上运行 Titnium Developer 后,我注意到瓶颈是硬盘。笔记本电脑上的 SSD 驱动器使构建周期比 4200 rpm 驱动器快 3-5 倍。在台式机上,在 RAID 1(条带模式)中使用双驱动器使构建速度比在具有更快 CPU 的单驱动器上快 25%,并且它也击败了 SSD 驱动器笔记本电脑。
Summary
概括
- From the comments in this thread there seems to be a fight for the number of platforms a tool like this can deliver app's for. The number of API seems to be the key selling-point.
- 从该线程中的评论来看,像这样的工具可以为其提供应用程序的平台数量似乎存在争执。API 的数量似乎是关键的卖点。
This shines through very much when you start using it. If you look at the open bugtracker you see that the number of bugs keeps increasing faster than the number of fixed bugs. This is usually a sign that the developers keep adding more functionality, rather than concentrating on getting the number of bugs down.
当您开始使用它时,这会非常闪耀。如果您查看打开的错误跟踪器,您会发现错误数量的增长速度比已修复错误的数量增长得更快。这通常表明开发人员不断添加更多功能,而不是专注于减少错误数量。
As a consultant trying to deliver rather simple apps to multiplatforms for a customer - I'm not sure this is actually faster than doing native app development on two platforms. This is due to the fact that when you are up to speed you are fast with Titanium, but then suddenly you look down and find yourself in a hole so deep you don't know how many hours must be spent for a workaround. You can simply NOT promise a certain functionality for a certain deadline/time/cost.
作为一名试图为客户向多平台交付相当简单的应用程序的顾问 - 我不确定这实际上是否比在两个平台上进行本机应用程序开发更快。这是因为当您达到最高速度时,使用 Titanium 会很快,但突然您低头发现自己陷入了一个如此深的洞中,您不知道必须花费多少小时才能解决问题。您可以简单地不承诺特定期限/时间/成本的特定功能。
About myself: Been using Python for two years with wxPython. (that GUI is inconsitent, but never breaks like this. It might be me that have not understood the threading model used by Javascript and Titanium, but I am not alone according to their open discussion forums, GUI objects are suddenly using the wrong context/not updating..???) before that I have a background in C and ASM programming for mobile devices.
关于我自己:在 wxPython 上使用 Python 已经两年了。(GUI 不一致,但从未像这样中断。可能是我不了解 Javascript 和 Titanium 使用的线程模型,但根据他们的开放讨论论坛,我并不孤单,GUI 对象突然使用错误的上下文/不更新..???) 在此之前,我有移动设备的 C 和 ASM 编程背景。
[edit - added part with bugs and not being thread safe] [Edit - now having worked with it for a month+, mostly on PC but some on OS X as well. Added iPhone and Android dual targetting. Added Trial and Error debug cycle speed.]
[编辑 - 添加了带有错误的部分并且不是线程安全的] [编辑 - 现在已经使用它一个月以上,主要是在 PC 上,但也有一些在 OS X 上。添加了 iPhone 和 Android 双重定位。添加了试错调试循环速度。]
回答by Evan Kirchhoff
The Corona SDK (Ansca Mobile) uses Lua as its coding language. See lua.org for more about Lua.
Corona SDK (Ansca Mobile) 使用 Lua 作为其编码语言。有关 Lua 的更多信息,请访问 lua.org。
While we plan to add further web integration and native-UI elements, our focus will tend to be on graphics-intensive applications, such as game development, as opposed to web-based technologies. In other words, we don't envision people writing Corona apps entirely in Javascript/HTML/CSS.
虽然我们计划添加进一步的 Web 集成和原生 UI 元素,但我们的重点将倾向于图形密集型应用程序,例如游戏开发,而不是基于 Web 的技术。换句话说,我们不希望人们完全使用 Javascript/HTML/CSS 编写 Corona 应用程序。
回答by Joseph Montanez
I have been working with Titanium for over a week now and feel like I have a good feel about its weakness.
我已经使用 Titanium 一个多星期了,我对它的弱点感觉很好。
1) If you hoping you use the same code on multiple platforms good luck! You'll see something like backgroundGradient and be amazed until you find out android version doesn't support it. Then have to revert to using a gradient image, might as well use it for both versions to make the code easier right?
1) 如果您希望在多个平台上使用相同的代码,祝您好运!你会看到类似 backgroundGradient 的东西,然后你会惊讶地发现 android 版本不支持它。然后必须恢复使用渐变图像,不妨将它用于两个版本以使代码更容易,对吗?
2) A lot of weird behaviors, on the Titanium android sdk you need to understand what a "heavy" window is just to get the back button to work, or even better orientation event tracking. This isn't how the android platform really is, its just how Titanium tries to make their API work.
2) 很多奇怪的行为,在 Titanium android sdk 上,您需要了解什么是“重”窗口只是为了让后退按钮工作,甚至更好的方向事件跟踪。这不是 android 平台的真实情况,而是 Titanium 试图使他们的 API 工作的方式。
3) Your thrown in the dark, Things will crash and you have to start to comment code and then when you find it, never use it. There are certain obvious bugs, like orientation and percents on android that have been a problem for over six months.
3)你被扔在黑暗中,事情会崩溃,你必须开始注释代码,然后当你找到它时,永远不要使用它。有一些明显的错误,例如 android 上的方向和百分比,这些问题已经存在了超过 6 个月。
4) Bugs .... there are a lot of bugs and they will be reported, sit around for months, get fixed in a few days. I am surprised they even are planning to release a black berry mobile sdk when there are so many other problems with android.
4)Bugs ....有很多Bug,他们会被报告,坐了几个月,几天后得到修复。我很惊讶他们甚至计划在 android 存在很多其他问题的情况下发布一个 black berry 移动 sdk。
5) Titanium Iphone versus Titanium Android javascript engines are completely different. On android version you can download remote javascript files, include and use libraries like mootools, jquery and so on. I was in heaven when I found this out because I didn't have to keep compiling my android app. The android apk installation process takes so long! Iphone none of that is possible, also the iphone version has a much faster javascript engine.
5) Titanium Iphone 和 Titanium Android javascript 引擎是完全不同的。在 android 版本上,您可以下载远程 javascript 文件,包括和使用 mootools、jquery 等库。当我发现这一点时,我在天堂,因为我不必继续编译我的 android 应用程序。android apk 安装过程需要这么长时间!Iphone 没有这些是可能的,而且 iphone 版本有一个更快的 javascript 引擎。
If you stay away from a lot of the native UI parts, i.e instead use setInterval to detect orientation changes, sticking with gradient images, forget about the back button, build your own animations, forget window header, toolbars, and dashboard. You really can make an api that works on both that doesn't require of lot of rewriting. But at that points its just as sluggish as a webapp.
如果你远离很多原生 UI 部件,即使用 setInterval 来检测方向变化,坚持使用渐变图像,忘记后退按钮,构建你自己的动画,忘记窗口标题,工具栏和仪表板。你真的可以制作一个不需要大量重写的 API。但在这一点上,它和 web 应用程序一样缓慢。
So is it worth it? After all the pain, its worth every minute. You can abstract the logic and just build different UI for each rather then if elseing everywhere. Titanium lets you make fluid applications, that feel fast. You lose the powerful layout abilities of each platform but if you think simple, things can get done under a single language.
那么值得吗?在所有的痛苦之后,它的每一分钟都是值得的。您可以抽象逻辑并为每个构建不同的 UI,而不是其他地方。Titanium 可让您制作流畅的应用程序,感觉很快。你失去了每个平台强大的布局能力,但如果你认为简单,事情可以在单一语言下完成。
Why not a web app? On entry level market android phones its horribly slow to generate a webview and consumes a lot of memory you could be using to do more complex logic.
为什么不是网络应用程序?在入门级市场 android 手机上,生成 webview 的速度非常慢,并且会消耗大量内存,您可以用来执行更复杂的逻辑。
回答by Tony Lukasavage
Here's a more recent and in depth analysis of Appcelerator and PhoneGap: http://savagelook.com/blog/portfolio/a-deeper-look-at-appcelerator-and-phonegap
这是对 Appcelerator 和 PhoneGap 的更新和深入分析:http: //savagelook.com/blog/portfolio/a-deeper-look-at-appcelerator-and-phonegap
And here's even more detail on how they differ programmatically: http://savagelook.com/blog/portfolio/phonegap-is-web-based-appcelerator-is-pure-javascript
这里有更多关于它们如何以编程方式不同的细节:http: //savagelook.com/blog/portfolio/phonegap-is-web-based-appcelerator-is-pure-javascript
回答by jhaynie
native mapkit is supported in Titanium
Titanium 支持原生 mapkit
回答by user158678
Making HTML5 widgets tha look like iphone widgets is one thing, but making them perform equally well is another matter altogether. Performance of html5 animations (even plain View Transitions), scrolling long lists, responsiveness to gestures feel sticky and jerky. An iPhone user will notice the difference.
让 HTML5 小部件看起来像 iphone 小部件是一回事,但让它们表现得同样好完全是另一回事。html5 动画的性能(甚至是普通的视图转换)、滚动长列表、对手势的响应感觉粘滞和生涩。iPhone 用户会注意到差异。
There's also some differences in the kinds of gestures that are supported by different devices which results in platform specific code and usability issues as well.
不同设备支持的手势种类也存在一些差异,这也会导致平台特定的代码和可用性问题。
I'll stay with native apps for now I guess.
我想我现在会继续使用本机应用程序。
回答by Adam Blum
Rhomobile Rhodes (http://rhomobile.com/products/rhodes) is very similar in approach to PhoneGap, but is the only framework with:
Rhomobile Rhodes ( http://rhomobile.com/products/rhodes) 在方法上与 PhoneGap 非常相似,但它是唯一具有以下功能的框架:
- a Model View Controller pattern (as most web frameworks provide)
- an Object Relational Manager
- support for all popular smartphones (including Windows Phone 7)
- a hosted development service (not just hosted build): http://rhohub.com
- a full debugger and SDK-less emulator in the RhoStudio IDE
- support for synchronized offline data
- 模型视图控制器模式(大多数 Web 框架都提供)
- 对象关系管理器
- 支持所有流行的智能手机(包括 Windows Phone 7)
- 托管开发服务(不仅仅是托管构建):http: //rhohub.com
- RhoStudio IDE 中的完整调试器和无 SDK 模拟器
- 支持同步离线数据
回答by gyozo kudor
For anybody interested in Titanium i must say that they don't have a very good documentation some classes, properties, methods are missing. But a lot is "documented" in their sample app the KitchenSink so it is not THAT bad.
对于任何对 Titanium 感兴趣的人,我必须说他们没有很好的文档,缺少某些类、属性和方法。但是在他们的示例应用程序 KitchenSink 中“记录”了很多,所以它并没有那么糟糕。