Go Back

Writing your First IPhone application in C# using MonoTouch

Writing your first MonoTouch application in C# for the IPhone framework using MonoDevelop and the IPhone 3.x SDK.

  • Facebook
  • Twitter
  • DZone It!
  • Digg It!
  • StumbleUpon
  • Technorati
  • Del.icio.us
  • NewsVine
  • Reddit
  • Blinklist
  • Add diigo bookmark

Comments  15

  • Jonathan Pryor 18 Sep

    Two notes:

    1. MonoTouch doesn't compile directly to ARM assembler.  The C# compiler compiles to IL (which means you can create projects that generate .dll files that you can then distribute/share between other solutions).

    Then, for *device* deployment, all the assemblies used by your program (e.g. monotouch.dll, mscorlib.dll, YourApp.exe) are linked together, unused types and members are removed, and ARM assembly is generated.  Method IL is removed from the assemblies, leaving only metadata (so you can use Reflection to list types & members, but you can't disassemble them to get anything useful; this saves space and also removes a common fear that someone will disassemble the assemblies to obtain your precious intellectual property).

    2. The second paragraph above (linking + ARM assembly generation) DOES NOT happen for the Simulator.  It's a *simulator*, not an emulator, and in this case the difference is gigantic.  The simulator runs x86 code, NOT ARM code, thus allowing use of the normal desktop Mono runtime to run the code.

    This is "good," in that it allows Novell to sell a simulator-only release that can't actually be used AT ALL to generate an app that will run on hardware.

    This is also "bad," because the simulator isn't a very good simulator for the actual hardware.  The simulator permits runtime JITing of method code, for example, thus allowing you to trivially create code that runs in the simulator but crashes on the device.

    Performance characteristics of the simulator can also differ dramatically from the device (e.g. GL graphics), to the extent that it's likely not worthwhile profiling on the simulator (as it may be completely different to the device, which is what really matters).
  • Lino Tadros 18 Sep

    Awesome, thanks a million Jonathan.  I understood the fact that the IL code never makes it to the device, but reading your comment was great and very much appreciated.  I am sure a lot of people are interested in doing this now and the more info out there for people to understand what is going on the better.
    Thanks a million
    -Lino
  • MonoTouch.Info 19 Sep

    Thank you for submitting this entry - Trackback from MonoTouch.Info
  • Brian 23 Sep

    I'm getting the following exception when I try to run the tutorial:

    Unhandled Exception: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSUnknownKeyException Reason: [<UIWindow 0x1070090> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key button.
      at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
      at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00000] 
      at MonoTouch.UIKit.UIApplication.Main (System.String[] args) [0x00000] 
      at HelloiPhone.Application.Main (System.String[] args) [0x00000] in /Users/jeanneriviere/Projects/HelloiPhone/HelloiPhone/Main.cs:15 

    thanks 

    brian
  • Sly 24 Sep

    Hi, thank for the screencast.
  • cowgaR 01 Oct

    Hi Lino,

    I watched around 5-7 Mono start-up videos, being a C# coder I've been _full_ of questions. None of them answered all of them for me, I've needed to figure out "architecture" for myself (not a big deal though).

    The problem wasn't complexity of Monotouch framework, problem was "immaturity" of screencast folks doing "hello world samples", it’s like “Apple coders” explain things to C# folks.

    Now, yours screencast is the first one that not only makes sense, but is free of little "bugs" (open new project - yet they are clicking on new solution, yes I know it is a nitpick, but it IS an error, solution is not a project! Clicking Forward is NOT clicking “OK”) that other screencast folks been full of.

    If I watched your video as first, I would be probably twice as excited as I am right now that someone can do it right, someone who does know how to explain (outlets..., interface architecture, that it is actually apple app appearing beside Monodevelop and so on...)!

    So great work Lino!

    Thank you for it, may I ask for your blog and if you are willing to put some commercial screencasts out, I am the first one to subscribe ;)

    note, my comment is _not_ about the topic, the Hello World app is pretty simple, it is about the ability to explain Monotouch problematic to Win/C# folks in few minutes in the right way!

  • cowgaR 01 Oct

    haha well I'm actually on your blog, well the formatting (in Firefox 3.x) looks really bad (click "home" for instance) so I thought I am on some "video aggregator" site with IE only compatibility, gosh ;p

    still, more screencasts welcomed!
  • Lino Tadros 01 Oct

    Thanks a million cowgaR,
    I am glad you like the videos.
    I am not sure I see the problem in FireFox.  FireFox 3.5.3 automatically adds the RSS logo on the site showing that it was able to read the feed.
    I also use Google Reader and point it to http://tv.falafel.com/blogs.rss.ashx and it works great.
    Hope this works for you
    Cheers
    -Lino
  • cowgaR 01 Oct

    tv.falafel.com/default.aspx looks badly formatted (probably css bug) in both IE7 (I don't really care about IE) and Firefox 3.0.14.

    I will try on my notebook with Firefox 3.5.x, I can send you a picture, clean firefox profile (no extensions).
  • Lino Tadros 01 Oct

    Yikes! I see it now, holy Moly! Thanks for letting me know.
    We use Telerik Sitefinity as the engine behind this web site, it is obvious something is going bad with the CSS in IE7 but it is horible in FF 3.0
    Everything looks good in IE8 and FF3.5, very weird.  CSS heavens!
    I will try to figure it out ASAP or get some help from the Sitefinity folks.
    Thanks
    -Lino
  • ManniAT 06 Nov

    Hi Lino,

    you inspired me on "our bulgarian bus tour".
    So I got a MacBook, all the tools and started looking around for some "how to get started" resources.
    I found some - but finally your video(s) made the things really going.

    Thanks a lot for this great work!

    Greetings from Austria

    Manfred 
  • Vivek Jhaveri 28 Nov

    I was puzzled at the lack of actions and outlets for the app delegate, until I found this in the latest version of the Interface Builder's guide:

    Beginning in InterfaceBuilder3.2, the management of actions and outlets have been moved from the identity inspector to the classes tab in the Library window. The only exception to this is the First Responder. Actions and Outlets for the First Responder have been moved to the attributes inspector.
  • Pavel 11 Dec

    Lino, excellent stuff!

    Please keep posting, you know the stuff and for me the MS WPF/Silverlight type of guy, this is just the right stuff I need to get started.
  • Peter 22 Jan

    Lino, thank you!  I had just started looking at Monotouch when I found your video, and it answered many questions I had about what to expect and the usability. Although the video and sweet, it was just what I needed.  So thankyou, and keep at it!
  • mie 03 Feb

    Really nice.

    Hadn't expected MonoTouch to be that great, and 400$ isn't much if you have a genuine idea.

    I might just buy a license :)
Post a comment!
  1. Formatting options