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

问题描述

作为一名.Net开发人员,我一直梦想有可能使用我现有的Iphone技能(c#)进行开发。



两个程序都需要Mac和安装了Iphone Sdk。



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

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



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



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



我也不确定所有Iphone api和featur的完整报道es。



Titanium还具有支持Android应用程序开发的优势,但作为ac#developer,我仍然发现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个小时,如果这样,如果那个以及其他那个和等等等等等等等。)



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



但是......那我也喜欢这个:

  public string SomeString {get;组; } 

使用Objective-C做同样的事情(在iPhone上,无论如何)要求你声明一个局部变量来支持属性,编写属性声明,然后使用synthesize指令为你生成属性(取决于你指定的属性属性,你可能有一个属性包含getters和setters,它们需要小心引用计数 - 总的来说,这个 节省时间,但C#Way在这里是明显的赢家。)



这是只是MonoTouch如何让您的生活更轻松的一个例子,特别是如果您已经习惯了.Net / Java / Python /其他语言,这些语言不需要让您的记忆管理变得肮脏(除非您愿意)。



就iPhone而言,除了将部分.Net带到iPhone世界之外,MonoTouch命名空间映射到CocoaTouch,所以如果你对此感到困惑比方说,MonoTouch UIViewController,你可以随便跳转到Apple关于UIViewController的文档。 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#MUCH比Objective-C更好,没有理由不去MonoTouch)




除非他们实际上使用他们的技术,否则不要听取反对者的意见再谈。例如,我读过有关Titanium的内容,但我对此并不熟悉 - 我只是因为我的偏好而知道我不想要它。这并不会让它变得糟糕 - 这只是我一生中不想要的东西。



Objective-C的人群可能会非常热心。虽然有很多开放的开发者,但是,所以所以很多人认为Objective-C和Cocoa,等等等等等,这是devkind将需要的最后一个开发工具。



忽略它们。



如果您担心支持,请考虑以下事项:




  • Apple很可能保持最新状态,因为他们是制作此垃圾的人。


  • MonoTouch很可能会保持最新状态 - Mono窥视与微软的关系做得非常出色,我认为他们没有理由不对Apple做同样的事情。我被他们的所作所为感到震惊。尽管MonoTouch已经发布,就像五分钟前一样,他们已经有了iPhone 3.1的更新资料。他们对此很认真,我认为他们很神奇。他们是开发世界的Keebler精灵。他们坐在他们秘密的层面,并为每个人(好吧 - 不是每个人)都喜欢,但没有其他人会尝试做。


  • Titanium要么是将成为一个尴尬的统一API,用于为多个平台编写应用程序,这完全是它自己的事情,或者随着不同平台的功能发生分歧,它将变得越来越分散。是的,这是一堆典型的扶手椅书呆子未来的凝视......我应该在这个项目前面写上这是我的意见......如果只有一种方法可以回去改变它。




我现在会闭嘴。



选择你想要的。 MonoTouch是Apple的安全替代品。我担心Titanium将会走下同样的老哎呀 - 这个超高级平台 - 抽象层 - 东西 - 不是真正有效的道路,而这么多其他技术都有。但是如果你做的很简单,那就试试它是没有害处的,特别是考虑到它在测试期间是免费的。



Aright。



现在真的关闭......我希望这会有所帮助。


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.

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

09-01 18:00