John Gruber has found out that cross-compilers are no longer allowed in iPhone OS 4.0. "My reading of this new language is that cross-compilers, such as the Flash-to-iPhone compiler in Adobe's upcoming Flash Professional CS5 release, are prohibited. This also bans apps compiled using MonoTouch - a tool that compiles C# and .NET apps to the iPhone. It's unclear what this means for tools like Titanium and PhoneGap, which let developers write JavaScript code that runs in WebKit inside a native iPhone app wrapper. They might be OK."

This move shows that Apple is very afraid of Android, WinMo7 and Blackberry app markets. It's a full blown platform war for world dominance (also a disaster for Adobe). But the move (revoking some memories of evil Microsoft) can be dealt with.

First, you need to write applications in C/C++ or even Obj-C.

Keep all platform interfaces encased with ifdefs. By using a text preprocessor, you can strip suspecting ifdefs before submitting to Apple.

Of course, one also needs something to translate to language (or VM bytecode) used by other platforms. This is the hard part as iPhone's apps use native language, so it won't work with some features of C/C++/Obj-C. I wouldn't be surprised if Google is already working on something like this. Yes, it requires extra work to do your app this way instead of using cross-platform libs, but it's worth it if you manage to support iPhone+ other platforms while competition can't.

If in any scenario Apple starts to loose the mobile platform war, this will loose them many developers and they will have to revert the decision.