在 iPhone 上快速开发应用程序的 Monotouch 还是 Titanium? [英] Monotouch or Titanium for rapid application development on IPhone?

查看:21
本文介绍了在 iPhone 上快速开发应用程序的 Monotouch 还是 Titanium?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为 .Net 开发人员,我一直梦想能够利用我现有的技能 (c#) 为 Iphone 开发应用程序.

这两个程序都需要安装 Mac 和 Iphone Sdk.

Appcelerator Titanium 是我尝试的第一个应用程序,它基于将一些 Iphone 原生 api 暴露给 javascript,以便可以使用该语言调用它们.

Monotouch 的起价为 399 美元,可以部署在 Iphone 上而不是部署在 Iphone 模拟器上,而 Titanium 是免费的.

Monotouch (Monodevelop) 有一个目前在 Titanium 中缺少的 Ide(但您可以使用任何编辑器,如 Textmate、Aptana...)

我认为这两个程序最后都会生成一个本地预编译应用程序(如果我不确定 Iphone 上最终应用程序的大小,因为我认为 .Net 框架调用是在 Monotouch 编译时预链接的).

我也不确定所有 Iphone api 和功能的完整覆盖范围.

Titanium 还具有支持 Android 应用程序开发的优势,但作为一名 c# 开发人员,我仍然发现 Monotouch 体验更像 Visual Studio.

您会选择哪一个?您对 Monotouch 和 Titanium 有何体验?

解决方案

就像任何工具或平台或语言或框架或任何问题一样,它应该真正归结为什么想要.

忘记所有如果你想为此平台开发然后你必须支付你的会费的建议.如果您对学习 Objective-C、Xcode 和相关的 Apple 位感兴趣,那么 goferit.我做到了.这很有趣,但的兴趣是开发 iPhone 应用程序.学习一门新的语言、框架和 IDE 只是一种奖励(我喜欢这些东西).刚开始的时候也是需要的.

自从 MonoTouch 发布以来,我一直在使用它,我喜欢它.更喜欢 C# 而不是 Objective-C,并且我喜欢访问 MonoTouch 提供的 .Net (Mono) 框架的子集..Net 比 Cocoa 更容易做某些事情(字符串操作、日期操作、任何 XML 等).

我也喜欢不再需要处理引用计数.多年来不必跟踪那个级别的资源,这让我很受宠若惊.我不介意自己清理,但我不想手动做一些我使用过的其他现代开发平台自动为我做的事情.另外,即使对于经验丰富的 Objective-C 开发人员来说,引用计数也不是轻而易举的事.有时滚动浏览 OS X 的控制台输出,看看有多少应用程序由于内存管理问题而崩溃(我知道 - 基本上任何应用程序都可能发生这种情况,但是当开发人员过度工作时,更容易犯导致这种情况的错误他们的注意力已经被 12 个小时的 if this 和 if that 以及 else this and else that 和 blah blah blah 摧毁了).

我仍然使用 Objective-C/Xcode - 我真的学会了喜欢 Apple 的工具.老实说,我觉得它们很尴尬,有点神秘,但仍然很有趣.

但是...然后我也喜欢这个:

public string SomeString { get;放;}

用 Objective-C 做同样的事情(无论如何在 iPhone 上)需要你声明一个局部变量来支持属性,编写属性声明,然后使用合成"指令来生成属性您(取决于您指定的属性属性,您可能有一个包装 getter 和 setter 的属性,这些属性为您处理引用计数 - 总体而言,这 可以节省时间,但是 C# 方式显然是赢家).

这只是 MonoTouch 如何让你的生活更轻松的一个例子,特别是如果你习惯了 .Net/Java/Python/其他不需要你用内存管理弄脏手指的语言(除非你想要).

就 iPhone-ness 而言,除了将 .Net 的一部分带到 iPhone 世界之外,MonoTouch 命名空间映射到 CocoaTouch,所以如果你对 MonoTouch UIViewController 感到困惑,你可以跳过到 UIViewController 上的 Apple 文档.MonoTouch .Net-izes CocoaTouch,但它足够接近,你不太可能撞到墙(如果你使用 Xcode/Objective-C,那也不会撞到).它很光滑.

钛是不同的.由于他们正在尝试(尝试)创建一个抽象层,让您可以为多个平台编写相同的应用程序,因此您将面临通常的缺点:完全不同的 API,失去灵活性(MonoTouch 也可以这样说,但程度不同),并且基本上必须学习一个全新的平台(这是您通过绕过 Xcode/Objective-C/CocoaTouch 试图避免的,对吧?).

我也讨厌 JavaScript,所以我会偏向于 Titanium.但即使情况并非如此——即使我可以使用我喜欢的语言——API 也不会满足我的幻想.或者我的任何东西.

无论您选择哪种开发工具,您都会最终必须了解一些有关 CocoaTouch 的知识.无论是 Xcode/Objective-C、MonoTouch 还是 Titanium,某些东西都会使您崩溃或变得不稳定,您最终将不得不参考 CocoaTouch 文档.

如果我要谈论 iPhone 的开发(我已经做了,我还会再做一次),如果我要讨论 Apple 开发工具的替代方案(我会),我仍然强烈鼓励开发人员至少可以使用本机工具完成一些基本的 iPhone 应用程序.这将使您成为该平台的更好的开发人员 - 时期.您可以使用这个开始阶段来确定您是否想要使用 Apple 提供的免费位以外的任何东西.你可能不会.我一直在使用 MonoTouch 是因为它让我满意 - 而不是因为它是必要的.

所以,总结几个基本标准:

  • 偏好(语言/框架)

  • 设备(您是否关心非 iPhone 平台或认为有朝一日可能?)

  • 舒适(如果您喜欢并了解 C# 比 Objective-C 多得多,那么没有理由不使用 MonoTouch)

不要听那些反对者的话,除非他们确实使用了他们所谈论的技术.例如,我读过关于 Titanium 的文章,但我没有使用它的经验——我只知道我不想因为我的喜好而与它有任何关系.这并不会让它变得糟糕"——只是我生活中不想要的东西.

Objective-C 人群可能非常热情.虽然其中有很多思想开放的开发者,但也有很多人认为 Objective-C 和 Cocoa 等等是 devkind 将永远需要的最后一个开发工具.>

忽略它们.

如果您担心支持问题,请考虑以下几点:

  • Apple 很可能会保持最新状态,因为他们是制造这种垃圾的人.

  • MonoTouch 很可能会保持最新状态——Mono peeps 在跟上 Microsoft 的步伐方面做得非常出色,我认为他们没有理由不对 Apple 做同样的事情.我对他们的所作所为感到震惊.尽管 MonoTouch 已经发布,比如五分钟前,他们已经发布了 iPhone 3.1 的更新.他们对此很认真,我认为他们很神奇.他们是开发世界的 Keebler Elves.他们坐在他们的秘密层中,制作每个人(好吧 - 不是每个人)都喜欢的东西,但其他人甚至都不会尝试这样做.

  • Titanium 要么会成为一个笨拙的统一 API,用于为多个平台编写完全属于它自己的应用程序,要么随着不同平台的功能出现分歧,它会变得越来越分裂.是的,那是一堆典型的扶手椅书呆子式的未来凝视......我应该在这个项目之前加上我认为......"如果只有一种方法可以返回并改变它.

我现在就闭嘴.

随心所欲.MonoTouch 是 Apple 产品的安全"替代品.恐怕Titanium 会走上与许多其他技术一样的老路——这条超高级平台抽象层东西并不真正有效.但是,如果您正在做一些简单的事情,那么试一试也无妨,尤其是考虑到它在测试期间是免费的.

好的.

现在真的闭嘴了...我希望这会有所帮助.

As a .Net developer I always dreamed for the possibility to develop with my existing skills (c#) applications for the Iphone.

Both programs require a Mac and the Iphone Sdk installed.

Appcelerator Titanium was the first app I tried and it is based on exposing some Iphone native api to javascript so that they can be called using that language.

Monotouch starts at $399 for beeing able to deploy on the Iphone and not on the Iphone simulator while Titanium is free.

Monotouch (Monodevelop) has an Ide that is currently missing in Titanium (but you can use any editor like Textmate, Aptana...)

I think both program generate at the end a native precompiled app (also if I am not sure about the size of the final app on the Iphone as I think the .Net framework calls are prelilnked at compilation time in Monotouch).

I am also not sure about the full coverage of all the Iphone api and features.

Titanium has also the advantage to enable Android app development but as a c# developer I still find Monotouch experience more like the Visual Studio one.

Which one would you choose and what are your experiences on Monotouch and Titanium?

解决方案

Like any which-tool-or-platform-or-language-or-framework-or-whatever question, it should really come down to what you want.

Forget all the if-you-want-to-develop-for-this-platform-then-you-have-to-pay-your-dues advice. If you're interested in learning Objective-C, Xcode, and associated Apple bits, then goferit. I did. It's been fun, but my interest was in developing iPhone apps. Learning a new language, framework, and IDE was just a bonus (I like this stuff). It was also necessary when I started.

I've been working with MonoTouch since it was released, and I love it. I prefer C# to Objective-C, and I like having access to the subset of the .Net (Mono) framework that MonoTouch provides. There are certain things that are simply easier to do with .Net than Cocoa (string manipulation, date manipulation, anything XML, etc.).

I also like not having to deal with reference-counting anymore. I was spoiled by years of not having to keep track of resources at that level. I don't mind having to clean up after myself, but I don't want to have to manually do something that every other modern dev platform I've used does for me automatically. Plus, even for seasoned Objective-C devs, reference-counting isn't a no-brainer. Scroll through OS X's console output sometime to see how many apps crash due to memory-management issues (I know - this can happen with basically any app, but it's far easier to make the mistakes that lead to this situation when you get overworked devs involved whose attention spans have been destroyed by twelve hours of if this and if that and else this and else that and blah blah blah).

I still use Objective-C/Xcode - I've really learned to like Apple's tools. I honestly feel they're awkward and a bit arcane, but still fun.

But... then I also like this:

public string SomeString { get; set; }

To do the same thing with Objective-C (on the iPhone, anyway) requires that you declare a local variable to back the property, write the property declaration, and then use the "synthesize" directive to have the property generated for you (depending on what property attributes you specify, you might have a property that wraps getters and setters that take care of reference-counting for you - overall, this is a time-saver, but the C# Way is the clear winner here).

That's just one example of how MonoTouch can make your life easier, especially if you're used to .Net/Java/Python/other languages that don't require that you get your fingers dirty with memory-mangement (unless you want to).

As far as iPhone-ness is concerned, aside from brining part of .Net to the iPhone world, the MonoTouch namespace maps to CocoaTouch, so if you're confused about, say, the MonoTouch UIViewController, you can just hop over to Apple's docs on the UIViewController. MonoTouch .Net-izes CocoaTouch, but it's close enough that you're unlikely to hit a wall (that wouldn't have also hit if you were using Xcode/Objective-C). It's slick.

Titanium is different. Since they're trying (trying) to create an abstraction layer that lets you write the same app for multiple platforms, you're going to deal with the usual drawbacks: Totally different APIs, loss of flexibility (the same could be said of MonoTouch, but not remotely to the same degree), and basically having to learn a whole new platform (which is what you're trying to avoid by getting around Xcode/Objective-C/CocoaTouch, right?).

I also hate JavaScript, so I'm going to be biased against Titanium. But even if that weren't the case - even if I could use a language I do like - the APIs don't tickle my fancy. Or my anything.

Regardless of the dev tools you choose, you will end up having to learn something about CocoaTouch. Whether it's Xcode/Objective-C, MonoTouch, or Titanium, something is going to break or go all wonky on you, and you're eventually going to have to refer to CocoaTouch documentation.

If I were giving a talk on iPhone development (which I have, and which I will be doing again), and if I were to discuss alternatives to Apple's dev tools (which I will), I would still strongly encourage devs to at least work through a few basic iPhone apps using the native tools. It's going to make you a better developer for the platform - period. And you can use this beginning phase to determine if you even want to use anything other than the free Apple-supplied bits. You might not. I've been using MonoTouch because it pleases me - not because it's necessary.

So, to summarize a few basic criteria:

  • Preference (language/frameworks)

  • Devices (do you care about non-iPhone platforms or think you might someday?)

  • Comfort (if you like and know C# MUCH better than Objective-C, there's no reason not to go with MonoTouch)

And don't listen to the naysayers unless they've actually used the tech they're talking about. For example, I've read about Titanium, but I'm not experienced with it - I just know that I don't want anything to do with it on account of my preferences. That doesn't make it "bad" - just something I don't want in my life.

The Objective-C crowd can be impressively zealous. While there are plenty of open-minded devs in it, there are so, so, so many who think Objective-C and Cocoa and blah blah blah are THE last dev tools devkind will ever need.

Ignore them.

If you're worried about support, here's some stuff to consider:

  • Apple is likely to remain current, as they're the ones making this junk.

  • MonoTouch is likely to remain current - the Mono peeps have done an amazing job keep up with Microsoft, and I see no reason why they won't do the same with Apple. I'm blown away by what they do. And despite MonoTouch having been released, like, five minutes ago, they already have an update out for iPhone 3.1 stuff. They're serious about this, and I think they're magic. They're the Keebler Elves of the dev world. They sit in their secret layers and crank out stuff everybody (ok - not everybody) likes, but that nobody else would even attempt to do.

  • Titanium is either going to become an awkward unified API for writing apps for multiple platforms that is entirely its own thing, or it's going to become more and more splintered as the capabilities of different platforms diverge. Yeah, that's a bunch of typical armchair nerdly future-gazing... I should have prefaced this bullet item with "It's my opinion that..." If only there were a way to go back and change it.

I'll shut up now.

Go with what you like. MonoTouch is a "safe" alternative to Apple's stuff. I'm afraid Titanium is going to go down the same old oops-this-super-high-level-platform-abstraction-layer-stuff-doesn't-really-work road that so many other technologies have. But if you're doing something simple, there's no harm in giving it a shot, especially considering that it's free during the beta period.

Aright.

Really shutting up now... I hope this helps.

这篇关于在 iPhone 上快速开发应用程序的 Monotouch 还是 Titanium?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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