ie8 fix
madison

How MonoTouch gets around Apple's VM restrictions

By | February 18, 2010, 11:16am PST

Summary: You’ve probably heard that Apple does not allow any interpreted or run-time compiled programs on the iPhone. That’s why you don’t see Flash, C#, or Java programs there. Now, companies like Adobe and Novell are trying to do something about that. In a ZDNet Q&A, Joseph Hill, product manager for Mono at Novell explains their approach with MonoTouch.

You’ve probably heard that Apple does not allow any interpreted or run-time compiled programs on the iPhone. That’s why you don’t see Flash, C#, or Java used on the iPhone. Now, companies like Adobe and Novell are trying to do something about that. In a ZDNet Q&A, Joseph Hill, product manager for Mono at Novell explains their approach with MonoTouch.

The MonoTouch project lets you run Mono programs on the iPhone. Mono is an open source implementation of Microsoft’s .NET platform sponsored by Novell. Normally, .NET code written, for example, in C# runs inside of a virtual machine. The VM takes an intermediate form of the code called bytecode (or in the case of .NET, MSIL) and either interprets it or does a Just-In-Time compilation to native code as needed. Apple doesn’t allow that, so as Joseph Hill explains, Novell had to take a different tack.

Ed: Why does Apple allow .NET development with MonoTouch when they don’t allow Java development on the iPhone/iPad?
Joseph: Java (and other runtimes) are restricted from being deployed to the iPhone because an application cannot execute writable memory. Virtual machines like Java and .NET generate native code from bytecode at runtime, and then execute this code; however, for various reasons, the iPhone kernel will not allow this code to be executed. Mono’s Ahead-Of-Time (AOT) feature avoids this issue by generating all native code that the application could generate at runtime ahead-of-time, so the application deployed to the iPhone is a 100% native application.

Ed: Does Ahead-Of-Time compilation make some features of .NET unavailable?
Joseph: The primary feature that is lost to AOT compilation is Reflection.Emit. (Since this would generate code that could not be executed.) Normal reflection is okay.

Next: Do I still need a Mac? >

Topics

Ed Burnette is a software industry veteran with more than 25 years of experience as a programmer, author, and speaker. He has written numerous technical articles and books, most recently "Hello, Android: Introducing Google's Mobile Development Platform" from the Pragmatic Programmers.

Disclosure

Ed Burnette

Ed Burnette is a Manager of Mobile Development at SAS. However the postings on this site are his own and do not represent the positions, strategies, or opinions of his employer.

Biography

Ed Burnette

Ed Burnette has been hooked on computers ever since he laid eyes on a TRS-80 in the local Radio Shack. Since graduating from NC State University he has programmed everything from serial device drivers and debuggers to web servers. After a delightful break working on commercial video games, Ed reluctantly returned to business software. He currently develops enterprise software for Android phones and tablets.

In his copious spare time, Ed writes and speaks about all kinds of technology and software. His most recent books include the Eclipse IDE Pocket Guide from O'Reilly and Hello, Android: Introducing Google's Mobile Development Platform from the Pragmatic Programmers.

Related Discussions on TechRepublic

Did you know you can take part in these discussions with your ZDNet membership?
17
Comments

Join the conversation!

Just In

RE: How MonoTouch gets around Apple's VM restrictions
FAULKNE 13th Oct
Good day to confirm this comment I would appreciate T h e b e s t o f Z D N e t d e l i v e r e d your website very nice to everyone Yes, Oracle is the only one with shared-disk architecture, but that is there advantage. It means you can add or remove nodes and the database lives on. In a shared nothing architecture, if you lose a node, you lose the system. I'm sure Oracle appreciates EMC highlighting their advantage.I also desire to signal in your RSS feeds. Thank you as soon as once again and maintain up the great operate Awesome post! Thank you very much || thanks for nice content this is really benefit to me.
0 Votes
+ -
mono iPhone = icrap
Linux Geek 18th Feb 2010
combine 2 proprietary technologies from monopolists like M$ & Apple and end up with a mess.
0 Votes
+ -
on something, cause they produced you: a mess
0 Votes
+ -
You're wrong on Mono
nDuDut 18th Feb 2010
Mono is open source, and is sponsored by Novell.
0 Votes
+ -
Yup - it HAS to be licensed that way
imric_z 19th Feb 2010
and written by those who truly believe that Microsoft's short-term limited covenant not to sue certain distributors means it is A-OK - IF you want to succeed at "poisoning the well" of free software, that is... J/K, Microsoft is all about giving competitors a leg up, and all about ameliorating any negative effect it's monopoly may have on the market...

Go, team Miguel.
0 Votes
+ -
I love what they're doing with mono, and this is the perfect
approach - bring .NET to platforms that MS wouldn't even
consider. This is a HUGE advantage to corporations that
can make use of existing resources and code.

With Win Phone 7 coming, which most likely will be
(mostly?) developed in .NET, this will give a way to share
development across many devices (considering mono is
now coming to android as well!).
0 Votes
+ -
Mono supports multi-task
LBiege 18th Feb 2010
So how does it fit in a non-multitask iPhone?
0 Votes
+ -
Is one way.
0 Votes
+ -
The iPhone multitasks quite well.
Ralfthedog 22nd Feb 2010
You can run as many threads on an iPhone application as the hardware can support. The multitasking restriction on the iPhone is related to outside events and applications.

Apple does not want a large number of applications running in the background. This eats up batteries fast. Thus, when the phone rings or another event interrupts the game you are playing, your applications is suspended. When your phone call is over, the application is restored.

Some Apple applications and processes are allowed to multitask. If you are playing a game or looking at a map, you phone can ring.

Application designers can create simulated multitasking applications with notifications. Lets say one of the users of your weather program is about to be run over by a tornado. You send a trigger to Apples notification server. The server tells your users phone to wake up the weather program and post a message. The weather program tells your user to duck and cover.

From the programmers perspective, the only limitation is that your program can't run when another program is running. From the users perspective, he does not lose the game because of an incoming phone call and his batteries last 10 times longer.
0 Votes
+ -
Contributr
Apple allows as many tasks (threads) in the foreground application as you want. In fact it's a necessity if your program is doing any network I/O or other long-running code so that your user interface doesn't get locked up.

What they don't allow is programs running in the background. Unless you're a special blessed Apple-written app like the music player or phone, as another poster noted.

Android allows background processing, but programmers have to be really careful not to overuse it, or it will drain the battery. That's why when the battery runs down and you get that "please charge your phone" message, there's a button at the bottom that will open up a list of the top applications that used the battery. If you spot a battery hog on the list you can uninstall that program and get another one that works better. Or not. It's entirely up to you.
I also desire to signal in your RSS feeds. Thank you as soon as once again and maintain up the great operate! nccma cooler
I used to be more than happy to seek out this internet-site.I wanted to thanks in your time for this glorious read!! I positively enjoying each little bit of it and I have you bookmarked to check out new stuff you weblog post. this thread is amazing i like your work and i appreciate you that you have share a useful stuff thanks for sharing the i shop abatwa
I used to be more than happy to seek out this internet-site.I wanted to thanks in your time for this glorious read!! I positively enjoying each little bit of it and I have you bookmarked to check out new stuff you weblog post.Bookmarking now thanks please consider a follow up post. power sa shop
I think the representation of this article is actually superb one. This is my first visit to your site. Thanks a lot and keep sharing the information. Keep updating the information for all of us. Thanks ZDNet Government was launched as the brand's first industry vertical, with a mission to cater to IT professionals in the public secto I agree with your post. However, do you have any sources I can cite for my paper wheel car com bury
Well welcome, hopefully you can become a vital member of the community and really help to push far ahead of google. Which Im sure the development team would love. This will of course earn you alot points too and get you on the leaders board. z d n e t t h a n k Im not sure i come to an agreement with you on every level, howevor it absolutely was a good posting, many thanks for taking the time to put up your ideas.
Thanks nice info z d n e t I really liked your current article write more..let me add you to its favorite The articles you have on zdnet s i t e are always so enjoyable to read. Good work and I bookmarked it.
Fantastic news about the new release.I positively enjoying each little bit of it and I have you b o o k m a r k e d to check out new stuff you weblog post.Im not sure i come to an agreement with you on every level, howevor it absolutely was a good posting, many thanks for taking the time to put up your ideas
Good day to confirm this comment I would appreciate T h e b e s t o f Z D N e t d e l i v e r e d your website very nice to everyone Yes, Oracle is the only one with shared-disk architecture, but that is there advantage. It means you can add or remove nodes and the database lives on. In a shared nothing architecture, if you lose a node, you lose the system. I'm sure Oracle appreciates EMC highlighting their advantage.I also desire to signal in your RSS feeds. Thank you as soon as once again and maintain up the great operate Awesome post! Thank you very much || thanks for nice content this is really benefit to me.

Join the conversation!

Formatting +
BB Codes - Note: HTML is not supported in forums
  • [b] Bold [/b]
  • [i] Italic [/i]
  • [u] Underline [/u]
  • [s] Strikethrough [/s]
  • [q] "Quote" [/q]
  • [ol][*] 1. Ordered List [/ol]
  • [ul][*] · Unordered List [/ul]
  • [pre] Preformat [/pre]
  • [quote] "Blockquote" [/quote]
ie8 fix
Click Here
ie8 fix

The best of ZDNet, delivered

ZDNet Newsletters

Get the best of ZDNet delivered straight to your inbox

Facebook Activity

White Papers, Webcasts, & Resources
ie8 fix
ie8 fix