Greeting, I'm a C# programmer guy. I'm planning to start developing app for iphone but I'm not sure if I should use C# under MonoTouch or just use the native language for iphone OS Objective C.
Is there 开发者_开发百科a different to program for iphone app using C# or Objective C?
Is there limitation using C# to program app for iphone or it can do as much as Objective C can do to develop iphone app?
MonoTouch wraps most but not all of the iPhone SDK. So, yes there are things you can't do (yet), but they're relatively few and far between.
Many .Net folks find that they are more productive (at least initially) using MonoTouch, since they can leverage their existing skills. On the other hand, there's nothing like working in the native language of the land, it just takes a little longer. You will have to learn some Objective-C since most documentation out there in the world uses it (and/or C-level CoreFoundation APIs). Objective-C's dynamic nature will feel foreign at first, but you may find it quite liberating once you grok it fully. Having used many languages in my career, I find Objective-C (and the Cocoa APIs) one of the most pleasant development experiences out there.
Here's a Monotouch developer's answer rather than some guess work from people skim reading blogs.
Have you bought the Monotouch license? If not then clearly objective-C would be preferred. If you have bought a license then it makes sense to develop the app in Monotouch because:
- The domain and business logic can easily be ported for a Windows Mobile 7 app later this year
- The same is also the case for Monodroid which is coming soon, and the API could easily be ported to Java too.
- Controllers, Views and the whole Monotouch system bar
static void main
can be very easily converted to objective-C. The names are all identical but in Pascal case.
As far as apps being accepted - so far Apple have let Monotouch apps through. I'm not saying they won't suddenly say "NO! THOU SHALL USE OBJECTIVE-C" but for them to ban an SO iPhone client on a high profile site like Stackoverflow would be bad PR.
Apple use apps in their demos which break their own SDK (Tap Tap Revolution being one), and 1 in 10 of the appstore best selling games use a health portion of none-objective-C.
Monotouch is a direct mapping to Cocoa and UIKit. You need to have a mac to use the compiler and IDE. As far as I'm aware Flash had no such restrictions and its UI was a lot less strict in terms of forcing the common "widget" set like UINavigationController, UITabViewController, UIAlertView and so on.
Here's my take: if you have absolutely never seen Obj-C code in your life, it'll take a bit of a time to get used to it. Put it together with the fact that the SDK is totally different and you'll have to learn every single new method, and it'll probably take at least a couple of months for you to become an average obj-c developer if you study hard.
Instead, use MonoTouch and learn the entire SDK using C#. In a couple weeks, you'll feel right at home with all the classes, Interface Builder, etc. You'll be able to develop the app in the same way you would with Obj-C, but in C#. The demo version allows you to use everything, for free.
THEN you decide what to do. Depending on how the whole issue with Apple goes, you may decide to just continue using MonoTouch, or you may decide to learn Obj-C, and basically use all the knowledge you have already gained about the SDK, which will make the transition much easier.
There is some debate over whether Apple will allow this. On the face of it, it seems not:
In the new version of the iPhone Developer Program License Agreement released by Apple today (and which developers must agree to before downloading the 4.0 SDK beta), section 3.3.1 now reads:
3.3.1 — Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs. Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine, and only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs (e.g., Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited).
From monotouch forums
精彩评论