11

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?

Eyla
  • 5,751
  • 20
  • 71
  • 116
  • 2
    I believe that this question covers the same ground as the one asked here: http://stackoverflow.com/questions/1583856/is-monotouch-worth-the-cost-or-should-i-just-learn-objective-c – Brad Larson Apr 23 '10 at 13:08
  • It does... but now this question has a different context, given Apple's new terms disallowing (technically) cross-compiled apps. – Armstrongest Apr 29 '10 at 23:16

4 Answers4

12

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.

miguel.de.icaza
  • 32,654
  • 6
  • 58
  • 76
Barry Wark
  • 107,306
  • 24
  • 181
  • 206
  • What is the statement "they've chosen to let MonoTouch apps through" based on? – Dan Rosenstark Apr 25 '10 at 17:40
  • @yar, several developers have reported that their MonoTouch-based apps were accepted after they accepted the new developer license. It's unclear whether Apple chose not to enforce ß3.3.1 for MonoTouch (my suspicion) or if Apple just hasn't started enforcing it yet. – Barry Wark Apr 25 '10 at 20:23
  • @Barry Wark, I thought there's no way -- presently -- for Apple to tell if the app is done with MonoTouch? Is this true (I mean, given current knowledge)? – Dan Rosenstark Apr 25 '10 at 22:58
  • @yar I have no idea whether Apple can identify MonoTouch apps. I'm not familiar enough with the MonoTouch AOT compiler to make a useful guess. – Barry Wark Apr 26 '10 at 00:46
  • Apple's main target is Adobe and their Flash to iPhone App converter. I think MonoTouch apps should be fine - I can't see how they could detect them easily anyway. – Callum Rogers May 04 '10 at 20:00
  • @Callum, that is certainly the general consensus, but is definitely *not* Apple's representation. – Barry Wark May 04 '10 at 22:53
  • @Barry, as of Sept 9, 2010, Apple has relaxed the development tools restriction a bit now: http://www.apple.com/pr/library/2010/09/09statement.html – sivabudh Sep 14 '10 at 17:40
10

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.

Chris S
  • 64,770
  • 52
  • 221
  • 239
6

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.

Eduardo Scoz
  • 24,653
  • 6
  • 47
  • 62
2

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

Topdown
  • 443
  • 1
  • 8
  • 17
  • 1
    I agree. Until Apple clarifies their stance on MonoTouch, I would consider it's use a serious risk for a commercial project. – Barry Wark Apr 23 '10 at 06:14