Compiling an iPhone XCode project to work on Android - iphone

I have an iPhone app which is written in XCode and is currently selling on the iTunes app store. I want to be able to release it for the Android market. Is there any way to compile my app from XCode to work on the Android operating system. I don't really want to learn a new language and completely rewrite my app, so was wondering if there is an easier way.

There isn't any way to compile Android apps from Xcode, and i strongly doubt that Apple would introduce such a feature - if it's even technically possible to do. Sorry.
But if you have Objective C down, you shouldn't have to much problems understanding Java (which is used for creating Android apps).
Check the link below for a pretty comprehensive guide to start learning java and code for the Android platform:
http://mobile.tutsplus.com/tutorials/android/java-tutorial/
Good luck!

No, in general you can't do this. Even if assuming Objective-C can be compiled/converted into Java (which is most likely will not be true for times to come), you'll need to rewrite UI part; then most of OS APIs are different too. There are several features that iOS has that Android lacks or does not have open API for it, or has limited API, or has conceptually different or just different API.
Its just easier to move some of your iOS code into C/C++ shared library and then make sure that it compiles and works on both platforms. And then make platform dependent pieces separately for each platform (UI, hardware related stuff, etc.). This way you'll have at least part of your code shared.

Related

Multiplatform development options

I have an application (actually a game) that I'm close to starting work on for iOS and the web, however I'd like to DRY up my code bases as much as possible so that I don't have to maintain so many aspects for platform portability. So essentially my two requirements are to run on iOS and the web, but I wouldn't mind it if I could also deploy it for Android as well.
What options exist?
If possible, which I am doubting at the moment, I have considered using Cappuccino (http://cappuccino.org/) to build out the app and then utilize NimbleKit for iOS compilation. Any ideas if this is possible?
What would work better if anything? Are there any frameworks in particular that would scale across platforms and mobile devices well + allow it to easily run on the web?
Also, Flash comes to mind, would that perhaps be best if developed properly such that it will compile over and not utilize non-compatible iOS functions?
The recently released monkey development framework deploys to both iOS and Flash:
http://www.monkeycoder.co.nz/
It's so new that I wouldn't necessarily recommend it, but it has a great pedigree: the creator made Blitz3D and BlitzMax before, and those were great game development tools.
That said, I would strongly recommend a combo like Corona for iOS and Flash for web, so that you're using optimal tools for each platform.
Check out Unity 3D. Works for iOs, Android, Web, Mac, and Pc. Not free for the mobile platforms, but it's worth a try.
You should try Titanium (it's free). You can use javascript and HTML5 to build your game and it can be compiled for iOS and Android. Since you will be using web standards to code, your application can be deployed for the web with few (or no) modifications.
You can use this project as a start point.

Is there a way to develop a cross-platform app for iPhone/iPad/Android? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Technology to write iPhone, BlackBerry and Android phone at the same time?
Edit - guys, we need one more vote to close this. This question is a dup (read the comments)
I've heard that Apple banned such tools. Ok, so Apple lifted their ban in September. Still, the question holds - is there a sane way to develop apps to these two platforms without writing nearly everything twice?
Is there something I'm missing, or is the current state of affairs really that every company that develops a cross-platform legally has to maintain two code bases?
Apple reversed their ban in early September after receiving some pressure from the FTC and EU. However, unless you plan on using a third-party tool such as Adobe Flash Pro CS5 (I believe you can create AIR apps that will run on Android this way, as well as the much publicized iOS functionality), you'll have to maintain two codebases anyway, as Android apps are written in Java and iOS apps in Objective-C, two vastly differently languages with vastly different APIs.
You can always use standard HTML5 technologies to make a pure web app. Apple has two tracks for apps: native apps through the App Store written in Objective-C, or web apps that have only the restrictions of the underlying HTML5 technologies.
If you don't like pure web apps you can even merge the two and make a custom app that displays heavily customized web-like content in an embedded browser view (UIWebKit on iOS). Android and iOS web browsers frameworks are from WebKit and very close in features/appearance/conformance.
Instead of starting from a viewpoint of "I can't do X on Apple's closed iOS" start with "Can I do this in any supported application technology, even if its web-based or a web app hybrid, available across all platforms?"
I've done some research on this recently and have found a few companies that can to do this for you.
Appcelerator Titanium Mobile. They make a product that allows you to write your code in Javascript. I've found that the business logic, like networking, files, etc are write once, but the UI has quite a bit of if(android) else \iphone logic to get right. Apps will look native.
FeedHenry. They are more of a HTML based solution, but have a broader support of devices. More than just iphone and android. The sdk is still pretty early, and work can only be done in their special ide that is web based.
Phonegap. A javascript/css/html based framework that targets the iPhone, Android, and the Blackberry.
There are plusses and minuses to all of the solutions. Depending on your app's complexity, it may be a good decision to pick a platform like those to develop on. Coding an app could be much faster if the features they support are right for your app. Right now, it seems that they are all in early release phases and don't support a full toolkit that a developer would be used to, like a debugger, full IDE support, etc. Also, many of them build to a lowest common feature set, so you may not get all of the new release features as they come out, you would have to wait for a particular version of the platform to be released in order to have them.
XMLVM: Android to iPhone
XMLVM can translate your Android code to Objective-C for iPhone. But as what I know you still need a Mac to compile the iPhone application.
Android has the NDK (native dev kit) to allow C and C++ code to be included in APKGs and called from Java via the JNI. Apple's toolchain will also deal with both; the code that will be different will be the platform interface code, mostly in Java on Android and ObjC on iOS.
This is only useful when the bulk of your application is in C or C++.
An alternate would be to go with MonoTouch and the upcoming MonoDroid, if everything works out you could basically code C# on all platforms including of course Win7 Mob.
It looks promising but haven't tried it myself yet.
In September, Apple lifted some of the restrictions in the iOS license that had made it difficult to do cross-platform development. See this press release. I'm not familiar with the details of the current license, but you can get a copy through their developer program.
Another possibility that would be the Rhodes framework, if you like MVC, ORM, and Ruby.
take a look at the System.getProperty() values with android the vendor shows as The Android Project. I haven't looked at the iPhone or the IPad since I don't have one but hopefully they have something changed for their's too. But this will only work with java that I know of.

Should I go for Flash/Java for iPhone development or continue with Apple tools?

As Apple has removed the restriction for java and flash should I go for these tools or just continue developing iPhone/iPad apps using Apple tools(Xcode, objective C .. etc).
I want to know the benefits of using apple tool instead of java or flash.
Thanks
Java is not an option anyway. There is no Java runtime for the iPhone that you can use to produce apps.
This is a no brainer. For iPhone, use Apple's SDK. You'll get latest APIs first than in any other platform, better performance, and, what's even more important, you are sure that Apple will keep pushing its API. With other products (like Java, Flash or Mono) you will always fear they changing their policies when they want. No guarantees.
It really depends on what kinds of apps you are making.
If you are just making a basic app, that you want to look like the standard Apple apps, you shouldn't switch.
If you really rely on Flash as a base, you should use that.
If you have little experience with Objective-C and prefer to code in C#/.NET, you may go for MonoTouch.
It really depends on your preferations, but if you want the most stable, reliable, and supported platform, you should go with Objective-C.
In my eyes, you should really only be using anything other than the standard Objective-C if it is utterly necessary, as others have pointed out; with Apple, you get the latest API's first, better performance, etc.
For new development I would jump in and use Apple's frameworks with Objective-C. If you're entering a new country you should speak their language. However, which development framework you choose will be largely dependent on whether or not you have an existing product. If you're just trying to target a new platform with an existing code-base it may be in your best interest to use an intermediary framework like MonoTouch or Adobe's Packager for iPhone.
If your codebase is Java, you'll be starting from scratch in Objective-C. Java is not currently available in any form on iOS.
If your codebase is in ActionScript 3, you may want to explore Adobe's Packager for iPhone. It will likely have a shorter path to market if your are porting an app already developed on ActionScript 3, but you will always be at the mercy of Adobe's intermediate layers. I know less about the Adobe bindings and how your application actually compiles, so I can't speak to any additional technical-risks there.
If your codebase is in C#, you may want to look at Novell's MonoTouch. Again, this may result in a shorter time to market. You still need to develop on a Mac (MonoDevelop only works on a Mac), and some .NET APIs are not available on Mono.
In any other circumstance I'd pick up Objective-C and use Apple's SDK directly. It's always tough to learn a new language (especially one as different as Objective-C), but it's worth it in the end.
Use the tool that will make the most sense for your goals and the experience you want to provide your users. Apple's lifting of restrictions only removes one risk: that using a framework not endorsed by Apple will be the sole reason for App Store rejection. The lifting of restrictions will not remove other risks that may exist like:
Continued support by third-party vendors (Novell, Adobe) of their frameworks.
Inability to target/test against the newest version of iOS until third-party frameworks add official support.

support iphone,ipad,android

develop android apps that should support iphone,ipad,android.is there any way for developing this kind of generic app or we need to develop aps depending on mobile os
Though it is possible to create an universal application for iphone and ipad i don't think you can do the same for Android.
In my opinion it is always better to port your application to Android based on your requirements so that you can take advantages of the API's that the platform is offering you.
You can try using a framework named Titanium Appcelrator. This framework will help you target iPhone, iPad, Android with the same code base. This also lets you access most of the Native hardware features available with these platforms but not all. It seems that this also may support Blackberry soon.
We are struggling with the same question at the moment. Since we are working for Android, Maemo, Meego, iPhone and Blackberry (+Symbian 3 soon), HTML5 looked promising, and we dedicated quite some time investigating it. The end result was HTML5 is not yet ready for the development we were hoping for. It's fine if you need simple functionality, but as soon as something more advanced is needed, you need to create a different version. Even if it suits your needs, every platform requires different HTML5-to-native bridge, and every platform has a different engine. As you can see, only front end part could be partially used.
In your case, you need two different applications, one for Android, another one for iPhone/iPad. Try to see if you could take advantage of HTML5, if not, you are unfortunately stuck with separate development for some time to come. Unless you will create a web app and use it with device's browser.
You can create common functionality libraries with C or C++ and use these libraries in iPhone/iPad and use Android's NDK tool to integrate theses libraries with Android
On Android, you're using Java as the main language, and you can also use C and C++ . On iOS, you're using Objective-C as the main language, and also can use C and C++. So the common denominator would be C (at least on the iPhone there are no C++ GUI classes). I have no idea about developing on Android, but on iPhone it's no fun to purely work in C (and I'm not sure if it's even possible, maybe it is but should I when working with Objective-C/Cocoa is fun).
What you can do is write generic logic and share that between both systems, like a library. For example, I worked on a project where we used a C++ SIP/VoIP library that also compiles and runs on Symbian. It shouldn't be a big problem to write C code that can be shared between iOS and Android, as long as it is mostly about logic and not about calling system-specific stuff (you can of course include system specific stuff and guard that with #ifdef but you don't want your library to have more system-specific than system-agnostic code, I guess). For example, if you intend to write a networked game you could implement the network protocol in a way that could be shared between iOS and Android.
But as soon as you're hitting the GUI level I don't think you can share any code, and even if you could you probably don't want to because if you use the native languages/IDEs you are faster designing the GUIs each in their respective main languages/IDEs than trying to find a common way and then have to live with compromises and trying to make it work on both systems all day long. Better to implement the GUI native to each platform (e.g. Xcode has a very good graphical tool called Interface Builder that can save a lot of work/typing).
we can go for the XML VM to run the android apps in iphone.
Check this for more info.
xmlvm.org

Do i have to buy mac for iphone application development?

Is there any MacOS virtual machine that can run on PC?
Is there any source to get it?
What is the best way to develop apps for iphone?
Yes all the developer tools are OSX only.
There are lots of iPhone development books out there go check out amazon and find one with some good reviews and that will get you started.
You might not, in the strictest terms, have to get a Mac to develop for iPhone; but it will be extremely helpful. Apple is relatively talented at squashing efforts directed towards Hackintoshes and virtual machines running OS X.
The shortest answer that will give you the least hassle is: Yes you need a Mac.
But, as far as I know there are a few possibilites, that try to reimplement some Cocoa Frameworks (however they might be Mac OS X only and not iPhone): GNUStep is an example.
But I don't think you get something aquivalent to Xcode (the IDE for iPhone development) this way.
And I think there are some OSX86 Virtual Machines (however these seem to be against Apple's EULA and thus seem to be clearly illegal so I won't point you anywhere to get them).
So to conclude - if you want to develop for iPhone: getting a Mac is the easiest way, even though not cheap.
Hope this helps.
The short answer is - yes.
One possibility for learning some of what you need to know before getting a Mac is GNUstep.
However, GNUstep is mainly useful for learning Objective C, especially since it provides many of the classes that the Cocoa toolkit for iPhone does. This can be run on Windows.
It doesn't, however, support some of the key 2.0 language features that are used 'all the time' in any sample code.
What it will allow you to do is design a UI using their UI designer GORM, and use a near-identical message-based system for implementing a UI, and you could theoretically write Objective C classes in GNUstep and then use them on iPhone.
However, to compile an app for iPhone you basically need to have a Mac, because then you can get the key for signing an app, etc. Since you need to get a Mac at some point, there's really little point in going the much harder route of using GNUstep first and learning a more limited implementation, unless you really need to get started before funds are available.
Despite the new SDK terms that can other programming languages, if you're really wanting to start without a Mac, I'd probably be tempted to look at something like Unity, or perhaps even Appcelerator Titanium, and figuring out all the non-platform-specific logic first on whatever platform (Unity has a free version that can be run on Windows, for example).
I'm not that big a fan of xcode, but is is far and a way the best IDE for Objective C development simply because there's almost nothing else out there.
There are, as always, other options. If you do a web app type project, you can implement the website and test a lot of it in a browser. Furthermore, since Android and iPhone browsers are both WebKit based, you can use the free Android SDK to see what pages look like on a comparable mobile device. And since you can use C and C++ classes as well as Objective C (N.B. not for the GUI, since that needs the Objective C extensions for messaging between objects), another option for making a start without a Mac would be to use Eclipse, QT Creator or some other C/C++ IDE to implement non-GUI classes, so long as you make sure you don't use platform-specific libraries.
But the end of the long answer is still that whatever you do, to compile a proper iPhone app you'll be using xcode and associated tools to finally build it and sign it, and so you need a Mac in the end. If you want to create something targetting the iPhone and won't have access to a Mac, then perhaps you're best off looking at creating an iPhone-adapted website using iui or a similar toolkit to give the site a suitable look and feel.