views:

540

answers:

5

From what I understand, Apple has banned the Flash runtime on the iPhone because Apple doesn't want an alternative runtime environment to that which Apple provides via their own tools. Allowing a Flash runtime, according to Apple, would allow developers to circumvent application update policies and other controls which Apple has put in place. And at this time, Adobe has not chosen to build tools to statically compile apps created in Flash.

My further understanding is that .NET apps created via MonoTouch are statically precompiled and hit the iPhone as native code vs. running inside the .NET common language runtime (CLR), which Apple would surely disallow. Since .NET code is not executing in Microsoft's runtime but rather natively on the iPhone CPU, Apple isn't complaining.

My questions are:

  1. Am I correct about why Apple allows .NET-developed applications on the iPhone?

  2. Is one vendor's precompiled, native code on the iPhone (or any platform I suppose) distinguishable from any other? In other words, is native code that's produced by MonoTouch indistinguishable from native code produced by compiled Objective C code? Is the source of the native code totally opaque?

+18  A: 

As you just said, Apple is not "allowing" .NET to run on the iPhone - whether an application was developed in MonoTouch or written in Cocoa or COBOL or whatever doesn't matter; it only matters what it is compiled to. It could be written in JavaScript and it wouldn't matter.

If I write something in English and then translate it to French, can a French reader tell the original version was written in English? Maybe, probably not, and it's all up to the characteristics of the translation, not the reader. All Apple requires is the version you give them is written in French. Up to that point it makes no difference.

A logical extension of this is that you could, in theory, write a compiler for Flash files that creates self-contained iPhone binaries. If developing in Flash is what's important to you. (This may or may not have already been done This has already been done.)

Rex M
I believe Apple *does* allow .NET apps on the iPhone.
Emilio
@Emilio no, they do not. Please read my answer more carefully.
Rex M
@Emilio - The second paragraph of your question explains why Apple *doesn't* allow .NET apps. Once compiled to native code, the application is not ".NET" anymore, in the sense that it doesn't require a preinstalled .NET runtime and libraries.
Michael Petrotta
Hi Rex - while I do understand your answer I'm not sure it's correct. With regard to the English to French example or the COBOL example, it's not clear to me that one implementation's machine code is different than another's. I'm not saying this isn't the case, I'm just not sure based on the example. Second, to clarify, are you saying that no MonoTouch .NET apps end up on the iPhone (non-jailbroken ones at least)? I thought there's a development community around that - where are the apps going?
Emilio
@Michael - I think I see what you mean - perhaps I should word the question differently. By a ".NET app" I mean one that's developed using .NET languages and tools. I'm not referring to the resulting app.
Emilio
@Emilio it's only different if the compiler elects (through choice or incompetence) to include characteristics in the target binaries that are flags or clues to the original language.
Rex M
@Rex - Ok that part I understand. But regarding your statement, "you could, in theory, write a compiler for Flash files that creates self-contained iPhone binaries.", so the whole reason we don't have Flash on the iPhone is because Adobe doesn't want to move from their runtime model to a pre-compiled model like MonoTouch chose?
Emilio
@Emilio - I understand what you're saying. I think that you should continue to emphasize that distinction, because it's an important one. Apple generally disallows runtimes. An application developed with Monotouch doesn't require a runtime, and so it's not blocked by that prohibition.
Michael Petrotta
@Emilio: I don't know Adobe's motivations, but yes, if their tools provided native executables, they'd likely be approved by Apple.
Michael Petrotta
@Emilio no, it's not about what Adobe wants or doesn't want to do with Flash, it's because it wouldn't *be* Flash anymore, it would just be using Flash as the authoring environment for an iPhone app.
Rex M
@Michael - I agree completely. I think this comment stream started as a result of Rex M's comment, "Apple is not "allowing" .NET to run on the iPhone - whether an application was developed in MonoTouch or written in Cocoa or COBOL or whatever doesn't matter...". He's right, but it wasn't my intent create a distinction between saying ".NET running on the iPhone" and ".NET-developed apps running on the iPhone." But I'll edit the question to clear it up.
Emilio
Clarity of communication, and defining your terms, is particularly important in our field.
Michael Petrotta
@Michael - agreed, obviously. So obvious in fact that you prob didn't need to comment on it. :)
Emilio
@Rex - << it's only different if the compiler elects (through choice or incompetence) to include characteristics in the target binaries that are flags or clues to the original language >> I think this is incorrect based on the other responses. The consensus seems to be that once compiled to native code, it's opaque and indistinguishable.
Emilio
@Emilio: I've heard similar comments about my pedantic communication style before, usually accompanied with groans. Good edit to the question, btw.
Michael Petrotta
@Michael - Thank you, I appreciate that.
Emilio
Adobe already does this. You can compile your Flash as an iPhone application exactly like mono does. http://labs.adobe.com/technologies/flashcs5/appsfor_iphone/
Lounges
"It could be written in JavaScript and it wouldn't matter." True: http://www.appcelerator.com/products/titanium-mobile/
Brad Larson
+1  A: 

Apple doesn't care about VM's running on the iPhone. It cares about allowing external, non-appstore code to be run on the iPhone.

That's why Apple won't care about Adobe's proposed "Flash Compiler" that makes standalone Flash apps. That's why Apple doesn't care about compiled .NET projects.

Recall the issue with the C64 emulator. Apple only cared that it bundled the internal BASIC, yet an emulator is a perfect example of a VM. All of the C64 code being executed by that VM is 6502 Machine code. But the emulator lacks the ability to download arbitrary code from the network and execute it.

That's what Apple is concerned with.

Will Hartung
<< Apple doesn't care about VM's running on the iPhone. It cares about allowing external, non-appstore code to be run on the iPhone. >> But then why can't Adobe write an iPhone Flash VM and have Flash developers introduce their apps through the appstore?
Emilio
Apple *does* care, very much, about VMs running on the iPhone. Emulators and VMs are subject to the tightest scrutiny and almost always rejected.
Rex M
I think what Will is trying to say is that VMs are allowed, as long as all of the code that they run is included in the app bundle, and no code can be added later. Adobe is free to make a Flash VM for the iPhone as long as it doesn't download content from the internet and render it--this is what they've done and are now beta-testing it with developers who are bundling their content with a copy of the runtime.
rpetrich
A VM that can't execute arbitrary code is hardly a VM. It's just a precompiled application with a lot of abstraction overhead.
fenomas
+1  A: 

All MonoTouch does is it transliterates the Mono code into objective C and compiles it to native code, so once it's compiled that can 'run' despite the usage of Mono. It's really a wrapper for the mono code which gets translated to the equivalent of the objective C native code and runtime libraries.

They are not really .NET runtime code per se. So there is no real distinguishable difference at all! Once it's compiled to native code that's it.

Hope this helps, Best regards, Tom.

tommieb75
@Emilio, This is probably the clearest answer here. This transliteration that tommieb75 mentions is why you still need the whole iPhone SDK installed, because MonoTouch needs access to the Objective-C compiler, which is really just the end stage of the process after translating .Net into native Objective-C. Apple are not allowing .Net to be installed into the iPhone and they've basically established a blanket ban on installing any system that can execute runtime code independently to the native API, which for example is just one of the reasons why Flash is also excluded.
S.Robins
This is incorrect, there is no Objective-C transliteration. MonoTouch precompiles the IL directly to the native assembly code that the JIT would generate. It links this into a native binary which also embeds parts of the Mono runtime (but not the JIT). This runtime works like the normal Mono runtime, except that instead of JITing IL code, it uses the linked-in precompiled methods. The Apple SDK is needed for the assembly/linking of the native binary, the code signing, the Simulator, and Interface Builder.
mhutch
A: 

1 - You're pretty much correct. I wouldn't say that Apple "allows" MonoTouch apps on the platform, they just haven't said anything publicly either way, and there are some MonoTouch apps already in the app store. Doesn't mean that they won't start blocking them all tomorrow.

2 - I don't know much about the internals of Mono Touch but I would imagine that there must be some common traits that MT apps have (the way it inflates the binary size, there's gotta be some commonality in there somewhere) that Apple can use to single them out. Of course, that might take an incredibly significant effort for little benefit, and they probably would rather spend their time in getting 3.2 and beyond out the door.

I think you're kinda confused about the differences between tools used to develop native apps and what kind of browser plugins Apple wants to support in Safari. Completely different concepts. I think you should read John Gruber's recent piece for a pretty comprehensive theory on why Flash will probably never be on the iPhone or iPad.

bpapa
A: 

It seems that soon you will be able to make native iPhone applications directly from flash.

http://labs.adobe.com/technologies/flashcs5/appsfor_iphone/

It will be interesting to know the performance of these apps, but for the General Media/Marketing/Business sectors, I think this is exactly how a lot of apps will go.

optician