views:

9334

answers:

12

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?

A: 

Of the solutions you mentioned, none of them appear to give you direct access to the MapKit framework introduced in OS 3.0.

As the Google Maps HTML widgets aren't nearly as good as MapKit (see Google Latitude for an example), you are probably best off developing a native Cocoa touch application, or choosing a solution you can extend to add MapKit integration. PhoneGap is extensible in this manner (it's open-source so it is by default), and some of the other solutions might be as well.

edit: Titanium now has support for MapKit

rpetrich
Thank you. But is there any essential difference between PhoneGap and Titanium?
Mickey Shine
MapKit has been available natively in Titanium for quite a long time.
jhaynie
@jhaynie: Thanks. I've revised this answer to reflect that Titanium now has support (it didn't when it was written in September)
rpetrich
+40  A: 

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 is different 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 native UI 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.

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.

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.

Titanium apps become native apps - they're just developed using web dev tech.

What does this actually mean?

  1. A Titanium app will look like a "real" app because, ultimately, it is a "real" app.

  2. A PhoneGap app will look like a web app being hosted in a browser control because, ultimately, it is a web app being hosted in a browser control.

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.

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?

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

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.

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.

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.

Have to go now. My girlfriend has that could-you-please-stop-using-that-computer-for-three-seconds look on her face.

Rory Blyth
Thank you very much for your answer and it makes me more clear about PhoneGap and Titanium~ Thank you again
Mickey Shine
The problem with the answer is that it's mostly WRONG. See DennisJZH's answer below.
jbwiv
@jbwiv - The problem with your comment is that it's mostly based on DennisJZH's answer, which is mostly WRONG. See my responses below. To avoid further confusion, I'd suggest you both take a look at the official documentation for the products and also read my post *in full*. Thankyouverymuch.
Rory Blyth
You should listen to your girlfriend she is more important then anything discussed here - all of these questions will be irrelevant sooner then later - technology enables new technology but never a guarantees one to be a better human or help a relationship.I still stand behind apples tools - you code python w/xcode - you can even convert it to objective c - take the time to understand xcode in depth - why ask questions if you aren't willing to try new things anyway - why work at anything at all if you don't want to be the best at what you do.Peace
TouchGameDev
@Matthew - Oh, the gf definitely has priority :) As for these questions being irrelevant basically because change happens (if I misunderstood your meaning, I apologize), the fact is that people do want answers to issues that exist right now. We could argue that none of this matters since the Earth is just going to get cooked in the future by the Sun as it burns its fuel and expands, destroying our planet, but... this gives us something to do while we wait.
Rory Blyth
@Matthew - Also, this person *is* willing to try new things. It might not be the way you prefer, but it's still new. You still have to learn about iPhone development (read the docs on UI guidelines, etc.) There's no justifiable reason to try to turn someone away from trying to accomplish something just because you don't see the value in it. For example, I hate mushrooms, but don't try to stop other people from eating them. I understand that they like mushrooms in the same way I love saffron, and I know I don't want anyone trying to take saffron away from me just because they don't like it.
Rory Blyth
+2  A: 

My understanding of PhoneGap is that they provide Javascript APIs to much of the iPhone APIs.

Titanium seems easier for a web developer background. It is a simple XML file to create a basic TabView application and then everything in the content area is controlled by HTML / JS. I also know that Titanium does provide some javascript access to some of the frameworks (particularly access to location information, the phone ID, etc).

UPDATE: Titanium added Maps API in version 0.8 of their framework.

Jackson Miller
A: 

You should learn objective c and program native apps. Do not rely on these things you think will make life easier. Apple has made sure the easiest way is using their native tools and language. For your 100 lines of javascript I can do the same in 3 lines of code or no code at all depending on the element. Watch some tutorials - if you understand javascript then objective c is not hard. Workarounds are miserable and apple can pull the plug on you anytime they want.

TouchGameDev
Apple may pull the plug...that's what I am concerning
Mickey Shine
Quote: "Apple has made sure the easiest way is using their native tools and language." They really haven't. If they wanted to do that, they'd provide, say, Python support. There'd be garbage-collection (which alone would reduce the frequency of crashes - most iPhone apps are terribly written). I dig ObjC, and, like you, I'd rather use it than js, but that wasn't the op's question. Also, MonoTouch makes development easier than any of these options. I can create a property in one line; get a reference to the Document folder with one line... and so on. Apple's bits could be greatly improved.
Rory Blyth
A good solution would be for Apple to provide their own ObjC alternative. Something for apps that don't need the level of control ObjC gives you. Especially for enterprise apps where devs should be focusing on functionality rather than reference-counting and property attributes. Or at least automate most of that with Xcode and the compiler. Give me a switch that allows for certain assumptions to be made and that can be bypassed in code where the dev chooses (like: retain and @synthesize my object properties by default - and, like the "real" ObjC 2.0, create my backing locals for me). Etc.
Rory Blyth
A: 

Wow, great explanation! Thanks for the info. I've been burning up the web looking for just this kind of comparison.

Thanks again.

Dwight Vietzke
This should be a comment attached to Rory Blyth's (quite nice) answer. Not an answer.
Nosredna
Except you can't, idiotically, add comments until you have a certain level of karma..
Peter Cooper
+37  A: 

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

DennisJZH
Um... you say that "PhoneGap is not just a native wrapper of a web app." You go on to discuss the access it gives you to native device functionality. I think I covered this when I wrote: "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 is different from deploying a plain old web app." If you registered just to refute my statement, you ought to have read it in its entirety. I know my posts are long, but... still.
Rory Blyth
I could have been clearer, but the details of which APIs is complicated since it has varied over time from device to device *what* you can do (it's improved a lot, but the feature matrix for different platforms has undergone quite a few revisions). I wrote about one of the key differences, and what I wrote is correct - in fact, it's in accord with what you wrote. You simply went into more detail about which APIs you can access.
Rory Blyth
As for Titanium and "native bits", I guess my mistake was reading this on their site - right on the front page for Appcelerator: "they run great because we compile Titanium to native code for peak performance." Perhaps you should write to them to let them know they're wrong. Check it out: http://tinyurl.com/yzlzvk5
Rory Blyth
For further information, check out the Titanium FAQ - the first topic, "Are these mobile webapps or native mobile applications" covers the issue succinctly. I'd repost a quote here, but I think you'd rather get it from the company directly, as they are, I believe, authorities on their product: http://tinyurl.com/ya9topg
Rory Blyth
Stumbled upon my first and only post on stack overflow several months later, I have to say that I am joyfully surprised to see that my post has received some useful votes. Thank you guys... That post was meant to be a comment.Rory, the intent of my post was for technical discussion, nothing personal. My apology if it was worded wrong.Now is the funny part. Google just told me that Mickey also posted the same question on the Titanium support forum. It is interesting to see how a Titanium staff compares these two apps. The date of the post just made me laugh.http://tinyurl.com/29dlen8
DennisJZH
Direct link here in case tinyurl let you down: https://appcelerator.tenderapp.com/discussions/titanium-mobile-discussion/553-what-are-the-differences-between-titanium-and-phonegap
DennisJZH
+3  A: 

native mapkit is supported in Titanium

jhaynie
+6  A: 

The Corona SDK (Ansca Mobile) uses Lua as its coding language. See lua.org for more about Lua.

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.

Evan Kirchhoff
Do you have any plan or time scale for native UI scripting. I've done quite a bit with Lua and I really want to love Corona. For non game development Titanium seems a bit ahead.
uroc
Hi, uroc. We've got native UI features arriving in release 1.1 (ETA later this week!), and more to follow shortly. However, my sense of Titanium is that they've done a nice job of exposing a large number of native UI elements, whereas we're going to focus on the most critical UI elements while pushing more engineering effort into animation and rendering features. The reasoning is that (i) there are already good products for UI-only apps, (ii) UI is the friendliest part of Cocoa (relatively speaking!), but (iii) anything involving OpenGL animation is a pain point on iPhone at the moment.
Evan Kirchhoff
A: 

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.

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.

+1  A: 

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.

kudor gyozo
A: 

Has anyone tried/heard about MoSync? If so, how do they compare to the aforementioned products above?

Bob
+2  A: