在今天的一个本地。net活动上,Mono的使用被“提及”为iPhone开发的替代方案。在c#和。net中非常舒适,这似乎是一个有吸引力的选择,尽管Mono堆栈有一些奇怪的地方。然而,由于MonoTouch的售价为400美元,我有些纠结于这是否是iPhone开发的发展方向。
有人用MonoTouch和Objective-C开发过吗?如果是的话,用MonoTouch开发比学习Objective-C更简单、更快,而且值得花400美元吗?
在今天的一个本地。net活动上,Mono的使用被“提及”为iPhone开发的替代方案。在c#和。net中非常舒适,这似乎是一个有吸引力的选择,尽管Mono堆栈有一些奇怪的地方。然而,由于MonoTouch的售价为400美元,我有些纠结于这是否是iPhone开发的发展方向。
有人用MonoTouch和Objective-C开发过吗?如果是的话,用MonoTouch开发比学习Objective-C更简单、更快,而且值得花400美元吗?
当前回答
使用Mono并不是一种依赖。它为iPhone操作系统增加了很多功能。LINQ, WCF, Silverlight应用程序之间的可共享代码,ASP。NET页面,一个WPF应用程序,一个Windows Form应用程序,还有针对Android的mono它也适用于Windows Mobile。
So, you can spend a bunch of time writing Objective-C (You'll see from many studies where the exact same sample code in C# is significantly less to write than OC) and then DUPLICATE it all for other platforms. For me, I chose MonoTouch because the Cloud App I'm writing will have many interfaces, the iPhone being only one of them. Having WCF data streaming from the cloud to MonoTouch app is insanely simple. I have core libraries that are shared among the various platforms and then only need to write a simple presentation layer for the iPhone/WinMobile/Android/SilverLight/WPF/ASP.NET deployments. Recreating it all in Objective-C would be an enormous waste of time both for initial dev and maintenance as the product continues to move forward since all functionality would have to be replicated rather than reused.
那些侮辱MonoTouch或暗示它的用户需要拐杖的人,是缺乏拥有。net框架的大蓝图,可能不理解逻辑与表示的正确分离,这种分离可以在跨平台和设备上重用。
Objective-C is interesting and very different from many common languages. I like a challenge and learning different approaches... but not when doing so impedes my progress or creates unnecessary re-coding. There are some really great things about the iPhone SDK framework, but all that greatness is fully supported with MonoTouch and cuts out all the manual memory management, reduces the amount of code required to perform the same tasks, allows me to reuse my assemblies, and keeps my options open to be able to move to other devices and platforms.
其他回答
所以,我对之前类似问题的回答是学习Objective-C。(另外,不要忘记调试支持)
This will probably offend some but to be honest, if you are going to do any serious development, you should learn Objective-C. Not knowing Objective-C in iPhone development will just be a hindrance. You won't be able to understand many examples; you have to deal with the quirks of Mono whereas if you had a working knowledge of Objective-C you could get a lot more out of the platform documentation. Personally, I don't understand the position that says increasing the amount of information you need in favor of using Mono over the platform's native language. It seems somewhat counterproductive to me. I think if this is a very expensive proposition (learning a new language) then it may be worthwhile spending some time on fundamental programming concepts so that learning new languages is a fairly cheap proposition.
另一位用户也这样写道:
现在单触摸对你来说更容易了。但之后就更难了。
例如,当新的种子出现时,你需要测试,但由于某种原因破坏了MonoTouch,会发生什么?
通过坚持使用Mono,任何时候你在寻找框架的资源时,你都必须在心里转换成你将如何在Mono中使用它们。你的应用二进制文件会更大,在使用Objective-C几个月后,你的开发时间不会更快,而其他应用开发者会比你更有优势,因为他们使用的是原生平台。
另一个需要考虑的问题是,您希望使用c#,因为您对该语言比Objective-C更熟悉。但是iPhone学习曲线的绝大部分并不是Objective-C,而是框架——你也必须调用c#。
对于任何平台,你都应该使用直接表达该平台设计理念的平台——在iPhone上,那就是Objective-C。从相反的角度考虑这个问题,如果一个习惯用GTK编程的Linux开发人员想要编写Windows应用程序,你会认真地建议他们不要使用c#而坚持使用GTK,因为这样做对他们来说“更容易”吗?
我已经使用MonoTouch几个月了,我从ObjectiveC移植了我的半成品应用,这样我就可以在未来的某个时候支持Android。
以下是我的经验:
不好的地方在于:
Xamarin Studio. Indie developers such as myself are forced into using Xamarin Studio. It is getting better every week, the developers are very active on the forums identifying and fixing bugs, but it's still very slow, frequently hangs, has a lot of bugs and debugging is pretty slow also. Build times. Building my large (linked) app to debug on a device can take a few minutes, this is compared to XCode which deploys almost immediately. Building for the simulator (non-linked) is a bit quicker. MonoTouch issues. I've experienced memory leak issues caused by the event handling, and have had to put in some pretty ugly workarounds to prevent the leaks, such as attaching and detaching events when entering and leaving views. The Xamarin developers are actively looking into issues like this. 3rd party libraries. I've spent quite a time converting/binding ObjectiveC libraries to use in my app, although this is getting better with automated software such as Objective Sharpie. Larger binaries. This doesn't really bother me but thought I'd mention it. IMO a couple of extra Mb is nothing these days.
好的方面:
多平台。我的朋友很高兴地用我的核心代码库为我的应用程序创建了一个Android版本,我们正在并行开发,并将其提交给Dropbox上的远程Git存储库,进展顺利。 . net。在c# . net中工作比在Objective C中工作要好得多。 MonoTouch。iOS中几乎所有的东西都映射到。net中,让事情正常工作是相当直接的。 Xamarin的。你可以看到这些人真的在努力改进一切,使开发更顺畅和更容易。
我强烈推荐Xamarin进行跨平台开发,特别是如果你有钱使用与Visual Studio合作的商业版或企业版。
如果你只是在创造一款在其他平台上永远都不需要的iPhone应用,并且你是一名独立开发者,那么我现在会坚持使用XCode和Objective C。
MonoTouch库的成本完全不是重点。你不应该在你的iPhone应用中使用Mono的原因是,它是一种拐杖。如果您懒得学习本机工具,那么我就没有理由相信您的产品值得下载。
编辑:4/14/2010用MonoTouch编写的应用程序不适合iTunes Store。这是应该的。苹果在Mac上看到了大量的浅端口,使用跨平台工具包,如Qt,或Adobe自己的System 7工具箱的部分重新实现,总之,它们不够好。
在这篇文章中有很多开发者没有尝试过MonoTouch和Objective-C的传闻。似乎大多数Objective-C开发者从未尝试过MonoTouch。
我显然是有偏见的,但你可以看看MonoTouch社区一直在做什么:
http://xamarin.com
在那里,你会发现一些开发人员用Objective-C和c#开发的文章。
我想补充一点,即使有一个公认的答案——谁能说苹果不会拒绝那些有迹象表明是用Mono Touch构建的应用呢?