现在的位置: 首页 > 综合 > 正文

Develop Cross Platform Mobile App

2012年12月09日 ⁄ 综合 ⁄ 共 11547字 ⁄ 字号 评论关闭
文章目录

Native Development, Titanium, Corona, Unity, Phonegap and more

 

Xcode
Ever since the iPhone has revolutionized the mobile phone and everything
about it, there have been several tools out there to create apps for
the iPhone, the iPad and all the Android driven devices. I have been
toying around with some of them and reading up on others. I concluded
that there’s a lot of tools out there and every single one of them is
completely different. The thing that struck me the most though, is how
many people don’t understand the differences. So here goes a blogpost
about the different tools I’ve come across and what they actually do.
I’ll run through them starting from the easiest ones to get started with
to the more hardcore ones.

I’m very aware I might be forgetting some tools. However the ones
listed here are the only ones I actually used at least once. Feel free
to add other tools, the way they work and your findings about it in the
comments. :-)

Note: If anything, I consider myself an iPhone developer, not so much
an Android developer, let alone a mobile developer. My findings and
views on things are based on my preference towards iOS development. I’m
not bashing the Android Platform. I just know more about the iOS
platform. I just wanted to state that for the record before you read on.

Phonegap

Phonegap
I’ll kick off with Phonegap. Why do I think this is the most simple one?
Well, it actually doens’t require the knowledge of anything new to
create your first app. If you have ever built a mobile web app, you can
create a Phonegap app.

Phonegap is essentially a web app -the same one you built the other
day at work- embedded in a native wrapper. You build the app using
HTML/CSS and Javascript. You can use plain old Javascript or make your
life easier by using jQuery, Prototype, Sencha Touch, MooTools, etc to
handle the interaction. Just like any other mobile website.

What the enduser sees is in effect a web app running inside a
webview. So what’s the native wrapper for? Well it provides Javascript
API’s to give access to the contacts, filesystem, camera, microphone,
GPS, etc. Phonegap provides the bridge to the API’s normal web apps
can’t get access to. It’s that simple.

Personally I don’t see the appeal; most definitely because the
browser performance doesn’t come close to native app component
performance. Think about scrolling through a list of 1000 entries.
I know a lot of people babble on about how you can ‘just turn your webapp into a native app‘.
But what’s the point!? That native app doesn’t provide anything the web
app doesn’t and it’s an app. You could as well make it a full fledged
web app which users can just add to the homescreen.

URL: Phonegap

Flash / Adobe AIR

Flash and Air
Yea, you didn’t see that one coming, did ya? Yes, Flash can create iOS
apps too. And of course you can create Android apps too (and you can
even create Flash websites for Android!). Why does Flash come second in
this list? Well anyone who can create a Flash app could create a iOS app
using Flash. The eagle-eyed viewer has already noticed how I mentioned could
in that last sentence. I have tried to create several apps (that
actually do something) and every time I ended up realizing the same one
thing: It performs like shit.

For those of you who don’t know: I spent the past 7 years being an active Actionscript developer. I’m not what one might call a Flash-hater.
I’ve tried to create simple games and apps for iOS using Flash. A game
using the accelerometer (which crashed when too much accelerometer data
came in simultaneously. Limiting that datastream kind of went in the way
of the actual game) and an app using the microphone (processing
microphone input on an iPad 1 was so hard that any UI interaction would
make the audio playback stumble). Both of them ended up staying ideas
until I finally get my head around native iOS development.

Flash can compile native iOS apps. Those apps are not interpreted at
runtime. Adobe says they’re actually generating the native binary that
you would get if you built it using Xcode. Seeing how the performance of
several natively-built games is perfect and Flash-generated apps (not
even games) perform horribly, I’d say Adobe has quite some work before
making Flash a viable tool for (at least) iOS development.

And I know what you’re thinking right now: “Dude, what about that Flash game that made #1 in the app store, not too long ago?“. Yea… Let’s talk about that… Why didn’t
it run on my 1st generation iPad? Did the app need a camera? No. Then
what else does the iPad 2 have, that iPad 1 doesn’t? Yes: CPU/GPU power.
Let’s face it: It’s not an overwhelming 3D game. It’s a 2D game. It
should run just fine on the 1st generation iPad. In comparison: The Back To The Future game (which is completely in real time 3D) runs just fine on my iPad 1. And so does the (rightfully named) Epic Citadel demo featuring the Unreal engine for iOS.

And if you have ever created a Flash app, you know how annoying
debugging can get. Well debugging a Flash app on a device isn’t exactly
what I’d call fun.

URL: Flash CS5.5Flash Builder 4.5

Titanium

Appcelerator Titanium
This is actually my favorite. It gives best of both worlds. Titanium
provides close to native performance (by using the native components)
whilst  having a simple and powerful API that gives access to just about
any interface either iOS and Android has. I created a few apps using
Titanium and all I can say is: It’s the fastest iOS app development tool
I’ve seen yet. You can create great looking and feeling applications in very little time.

You create the app writing Javascript and calling Titanium’s APIs. “How is this different from Phonegap
you think? Well, the Javascript you write is interpreted at runtime
(I’m guessing a WebView). However this webview is invisible and ONLY
does business logic. In fact: It only does custom logic. For example: When you create a TableView, you call Titanium.UI.createTable()
in Javascript. This calls a Titanium API that runs native code in the
background and returns a native iOS/Android component with native
performance.
You populate the table component using more Javascript.
Once the data is in there, the table behaves exactly as fast and smooth
as any other tableview in iOS… Because it is a tableview in iOS. (Or in Android… You get the point)

The Javascript calls to the Titanium API are mapped to native code in
the Titanium framework and generate native components. Events in those
components are sent back to your code in Javascript where you can handle
them. The end result is very fast performance. The slowest part of any
Titanium app is app logic/handling events in Javascript
(and let’s face
it: That’s still faster than you can blink). The UI interactions, UI
animations, UI effects and some platform specific calculations are
completely native.
Yes, native is key here. It means performance. Better performance means allows better user experience. (Some people still mess it up, even if performance is as good as it can be).

That native performance is wonderful. That’s why I love Titanium. The
only bad thing I’ve come to notice. You can’t do any kind of image
processing. So if you’re thinking about building the next Instagram(Camera image processing App: Instagram),
don’t use Titanium. Even though you have complete access to
iOS’/Android’s camera API, you can’t heavily edit the image… And the
same goes for editing audio/video. So in the end: Titanium can only
create data-driven applications
.

Oh btw: Titanium is free. It comes with a lot of luxury, some great
tools, good debugging and access to everything native on iOS and
Android! All that, for free. And open-source!

URL: Titanium Mobile Application Development

Corona

Corona Game Development
I first heard about Corona about a year ago. When I checked it out back
then, I didn’t seem all that convincing and I didn’t spend much time
exploring it. However when I was writing this blogpost I gave it another
glance and I have to say: A lot has changed.

It looks like Corona has truly grown up and provides a massive API to
create 2D games for iOS, Android and others. You write your code in Lua
and when done you create a game that runs at native speed. Since I
haven’t tested this myself, I wasn’t really convinced at first… until I
saw the demos that were created in only a few hours and performed exactly like the blockbuster hits in the App Store. That’s immense!

Yea, remember those ideas for Flash games I had? I might just give Corona a run for it’s money. Again: Might just.
If I spend 200$ for an application that should replace my free tools
(Titanium & Xcode), I’d better really build a game with it.

URL: Ansca Mobile – Corona

Unity/Unity3D

Unity
This is by far the most exciting tool of all. One problem: Unity is
designed to create 3D games. If you want to create a todo-app, this
isn’t what you’re looking for.

The development environment is great, you can write the code in
Javascript, CSharp and a handful other languages. The components can be
put together using drag & drop. There’s an insanely extensive
debugging environment. And when you feel the need to change some of the
generated Objective-C code… You can. Unity generates an actual Xcode
project before compiling the final app. You can access that project and
change things according to your needs.

The 3D assets can be created with almost any 3D modeling application
out there: 3D Studio Max, Cinema 4D, Blender and a few others. Unity
even provides ways of nicely importing them. There’s also a 3D modeling
feature in Unity itself, however I don’t know anything about it.
Soundscapes for the game can be created with any application you like
and then imported into Unity. Again: there seems to be a sound
editor/creator inside of Unity which they claim is pretty complete.

The one thing that I really love about Unity is the debugging
features. It’s just brilliant. There’s several levels of testing your
app.

  1. In-IDE testing: Just hit the play button and you can run the game inside the development IDE using the keyboard and mouse.
  2. Everything working fine? Okay, but now you’d like to test how the
    input with the iPhone or iPad work: Touch and accelerometer-based input.
    Well… There’s an app for that.
    The Unity Remote connects your iPhone/iPad over Wifi to your Unity IDE
    and sends the relevant input to the game running inside the IDE. At the
    same time you can see the game output (game UI) on your iPhone/iPad. The
    result is quick and easy testing of the game ‘on the device’ (since
    both input and output are both on the device) without installing it on the device.
  3. Okay: Now we want to really test on device. You
    know, the way you’d do it in Xcode for example. That’s possible too:
    Just run the app on the device and have full on-device-debugging power.
    It’s just a few clicks away. The full debugging power comes straight out
    of Xcode. There isn’t any other tool that comes close to Xcode’s
    device-debugging. At the same time you can see all your logging inside the Unity IDE too. There’s actually multiple ways of debugging depending on your personal preferences. How’s that for 1 tool… Some creative suites don’t offer this kind of debugging choices. ;-)

When you’re ready to deploy your app, Unity creates the actual native
app. Android, BlackBerry or iPhone (or desktop)(and soon Flash!!) are
supported. And if you think the performance of this will be horrible
since you’re creating a massive 3D game without writing native Objective-C: Nope. The performance is off the hook. It’s insanely good. Don’t want to believe me? That’s okay. How about Electronic Arts? Yea, if one of the world’s most famous game developers choses Unity, there is probably something to it.

URL: Unity3D

Xcode / Native iOS Development

Xcode

Xcode is the official toolset provided by Apple for any Mac and iOS
development. And yes: This one is last in this list since, in my humble
opinion, Objective-C is hard. I learned a way of implementing MVC at
school but as it turns out, the one used in iOS development is very
different. It requires quite some adaptation. There’s lots of strange
syntax I’ve never seen. The development environment is pretty big and
complex. Then there’s the .h and .m files (“What’s the difference…?“).
There’s something called storyboarding that seems insanely weird at
first, but actually makes total sense once you get what it’s for… Etc.
Yes, Xcode is definitely the hardest tool of them all to get started.

However I don’t think Xcode needs a lot of explanation. It’s the tool
provided by Apple. It’s what Apple considers the best tool they could
get in the hands of their developers. And to be truly honest: It’s a
pretty complete suite. It creates a native binary. There’s nothing more
close to home than this.

URL: Apple Developer Tools

Conclusion

Conclusion? There’s no conclusion! This was supposed to be a list of
different tools to create apps for iOS (and Android and others) and
explaining how they’re different from their colleagues/competitors.
But since you’re asking for one: I’d say depending on the kind of application you’re looking to build there’s a tool for you.

  • For 3D games: Use Unity. It’s powerful, it’s specifically designed
    to help you create games and you can create for multiple platforms.
  • For 2D games: I’d recommend Corona. It looks pretty promising. The
    API provides quite a lot of preinstalled game features (e.g. physics
    with Box2D). I’m pretty sure you can create a decent game with this,
    faster than you would in Xcode with Objective-C.
  • For purely data-drive apps: Use Titanium. You get the best of both worlds. Fast development & native look and feel.
  • For heavy calculating apps (e.g. Image/Video/Audio processing): Go
    native. It’s the only way. You could create a Titanium module which does
    the heavy lifting (using Objective-C)… But what’s the point. You could
    as well just create the entire app in Xcode then.
  • I don’t know when I’d ever use Phonegap to create an app…
  • Don’t use Flash.
I hope this was helpful for some of you. Let me know what you think in the comments.

抱歉!评论已关闭.