porting from ios to windows - objective-c

I'm about to write code for Windows that has somewhat similar functionality to the one existing in already written application for iPhone. I'm thinking of separating common functionality to form a component and compile it to both to iPhone and to Windows. This code is written in Objective C and uses RestKit and Core Data (and probably sqlite). Is compiling it for Windows a viable task? As I understand it GCC could compile Objective C on Windows but I'm unsure about the RestKit and Core Data api availability on Windows. I have seen two names that could be of use: GNUStep and Cocotron but I don't know if they will play well together with RestKit.
Note: I have no idea about iOS development so I might be confusing things. Any help is appreciated.

You will not easily be able to share this functionality between your applications. CoreData uses a custom opaque (not documented) format for the sql store. You would be hard pressed to reverse engineer this.
You will probably save a lot of time by rewriting that part for windows, rather than trying to get it working. There really isn't much iOS code that can be reused under windows, unless you have written pure C or C++.

Related

Generate Objective-C code from any other language

Are there frameworks/generators for producing iOS code from any other language?
A dynamic language like JavaScript, ruby or Python are preferred. Googling for iOS code generators was largely fruitless.
The problem with systems like PhoneGap is that their output is a full-fledged application. What I need to produce is a library (.a & .h file eventually) that other Objective-C developers can reuse in their projects.
RubyMotion may or may not do what you want. I haven't seen much about the practicalities of it yet, but I'm thinking since it's statically compiled chances are good that it can produce libraries that can be simply linked into Objective-C projects. One might need another tool to produce the header files.
Of course, this is all speculation.
I think the best solution for what you're looking for is Titanium. It has its own sdk (in JavaScript), a complete IDE and allows you to have one codebase for all major platforms (iOS, Android included). What it's really awesome is the fact that it actually generates native code (a valid XCode project or a Java one for Android). It's also free and open source. Definetely worth a look.
I've never seen code generators, but there are a variety of "spoofs" as it were.
http://xamarin.com/monotouch - iOS on C#
http://phonegap.com/ - iOS on HTML, CSS , Javascript
http://ipodtoucher55.blogspot.com/2010/06/how-to-create-iphone-apps-in-flash-cs5.html - one of several tutorials for flash on iOS
I've seen links to python libraries and I think java too.
When it comes down to it though, they're all work arounds, not direct development.

guidelines for developing a small Mac OSX project

I'm a .NET developer with some questions about a small Mac project coming up.
We are going to be creating a small program for Mac OSX. The software will need to have a simple UI (1 screen) and will need to consume a WCF web service.
Should we code on our Windows boxes or on Mac machines? We have a couple Mac Minis, but we mostly do Windows development.
What IDE/dev environment should we use? (Eclipse, Xcode, etc.)
How does Mac software deployment generally work?
...
No one has mentioned Java/Eclipse. Isn't that an option?
Here are two options:
Write in Objective-C, using Xcode on Macs
Write in C#, using Mono on Windows or on a Mac with SharpDevelop
The advantage of #1 is the resulting app will be much easier to deploy to others, but you might have trouble consuming the WCF service. It depends on what exact interface you are exposing and what the types of the parameters are.
The advantage of #2 is that you can use your C# skills. I don't know the state of WCF in Mono, and the GUI may not look native.
If you go with #1, the main issue will be using Objective-C. Since you are targeting the Mac, make sure you enable the Garbage Collector, or else you will have to also learn memory-management. If you use Xcode 4, it's similar in spirit to Visual Studio, although the details are different. For a simple project, following the tutorials will probably be enough -- I suspect the hard part will be interacting with WCF. To make your life easier, make the interface to the service extremely simple (simple parameter types and returns).
Your question is overly broad. You have two options:
When in Rome...: download Xcode, look at example apps, read Apple's documentation, find some tutorials, and learn Mac app development the usual way.
The Devil You Know...: look into stuff like the Mono project that will let you write a Mac app in C#, so you can use your existing libraries and don't have to learn Objective-C.
Which is better depends on your needs. If you just want to get a small app done and don't have a lot of time/money, I'd go with #2. If you're concerned about quality (compatibility libraries always have their quirks), I'd go with #1. My gut says #2 is better for you.

Programming for IPhone - Do you really need to learn Objective-c?

Looking on-line I saw that I can write most of the application in Ansi-C code or as a website and present it in a webView control.
Then besides some general knowledge about iOS and the API... Do I really need to learn Objective C?
You could use something like PhoneGap, which wraps an HTML-based application into a native launcher app. It may not be as powerful as what you can do with a pure native app, but on the other hand, your code will not only run on iOS.
PhoneGap does offer access to some of the phone's API (camera, notifications, accelerometer and so on) that you normally only get in native apps (it exposes them as JavaScript objects), so you can do more than you could in a regular HTML5 webapp, even without learning Objective-C.
Most people overlook the fact the iPhone has an extremely capable web browser. You can create very powerful web apps and therefore avoid having to learn objective C.
Safari on the iPhone has a bunch of great HTML5 features, including local sqlite stoage - so for example you could easily make a todo list app which could sync up with your server when there's a net connection.
You can even add home screen icons etc.. personally I'm astonished people don't write iPhone web apps more!
This is a super useful guide on how to do it:
http://building-iphone-apps.labs.oreilly.com/
You can use C# to write iPhone apps using MonoTouch, but it costs money. Then again, so does developing for the iPhone the normal way.
The other answers are correct in that you /can/ use other languages... you really don't want to. You are never going to create a pleasant to use, standard, and HIG-abiding application without learning Objective-C. Truly, though, there's no reason /not/ to learn something new. It's not particularly difficult (like, say, C++), and Cocoa is a well-designed API.
Somewhat related, I personally refuse to install all the PhoneGap/etc apps in the App Store as I find them of significantly less inherent quality (especially as compared to the rest of the apps on the device), and I would suspect many non-developers would have similar issues with them, if not so specific.
Unless your app is all web, or uses a framework such as PhoneGap you have to have some working knowledge of obj-C. It's actually not that bad. It's C with Smalltalk bolted onto it.
It's generally much simpler than C++.
if u want true native app that can take advantage of the latest features on the latest iOS release, Objective-C is da language you gotta learn.
Objective-C is a very powerful language, and there are a ton of great frameworks - you are doing yourself a HUGE disservice by not learning the language, and your app quality will suffer as a result.
You can write an entire iPhone app in C++ using a framework like libnui.

How hard is it for a .NET programmer to learn Objective C and Cocoa?

I'm trying to build a dual platform application for a company of my own I'm trying to start at night.
I have the .NET version done, but have not finished the UI part. I'm thinking of buying some 3rd party controls.
If I buy these controls, however, they clearly will only work in my Windows version. I'm wondering if I should try to do the UI in GTK# and use Mono with CocoaSharp or just build the thing in MS technology and teach myself the Mac side?
I'm just really unfamiliar with the Mac world and am wondering how much of a learning curve there might be.
I've thought perhaps of rewriting my core logic in Ruby or Python. This why I could use the .NET version with .NET controls and presumably hook the same code up on the Mac.
It's an educational app targeted at consumers. As such, it shouldn't require a lot of technical sophistication to install.
If the non-visual part of the .NET application is quite big compared to the UI, then you can go full .NET and adopt the following two-steps strategy:
Non-Visual Part
Develop the non-visual .NET part to be the most platform independent.
Platform dependent code for non-visual code should be isolated in small classes that provide the same interface so they could be plugged according to the platform.
User Interface
Use System.Windows.Forms (or your favorite toolkit) for Windows
Use a Cocoa bridge (see this page for the choices) for Mac OS X.
You still can benefit from learning Objective-C: as the Cocoa bridges are usually heavily based on the Apple's API, you will find a lot of help in the Apple's sample code (which are in Objective-C).
On Windows, the application will run with the Microsoft .NET runtime and on Mac OS X, the application will run with the Mono runtime.
The DeepMeta application uses this strategy. As you can see the user experience is quite good on both platforms.
Avoid using cross platform UI tools; the result will never be as good as a native implementation, which is especially bad on the OS X where most customers expect a certain level of polish in their applications. Implementing the core logic in a platform independent language like C++ and maintaining a different code base for the interface on each platform can be a good solution, especially if you have a very complex model.
Anyway, you shouldn't have too much difficulty learning Cocoa if you're a good .NET programmer; I did the reverse several years ago and didn't have much trouble. Objective-C is more C oriented than C#, but if you know the basics about pointers and such you're going to be okay. Cocoa and .NET definitely have their differences in certain areas, but they're both high level frameworks which you shouldn't have too much trouble understanding. Get a good book (Hillegass is the go-to author) and go through it so you understand how the two APIs use different design patterns in certain areas, and don't try to fight the framework if it's different than what you're used to.
In my experience this will make you a better programmer in the long run by expanding your knowledge, even if you don't write any more Cocoa applications.

What languages besides Objective-C will generate application code that works on an iPad?

I would like to write an app for the iPad but I can't stand Objective-C.
Is there a language generator that would spit out Objective-C but let me write my iPad application in another language?
I've heard a little about MacRuby and am curious whether it could be used this way. Any other similar projects in other languages?
C# with MonoTouch.
JavaScript with Appcelerator Titanium.
Flex with ELIPS Studio 3.
Python with PyObjC (for jailbroken iPhones though).
Apparently Lua is an option.
John McIntosh uses Smalltalk on the iPhone. For instance, his Mobile Wiki Server app.
No computer anywhere (well maybe some) cares what language you write your programs in. Heck, you could hand-write machine instructions if you were patient (and crazy) enough. As long as you can figure out how to interact properly with the system call interface and the ABI, you can do whatever you want.
You could use Corona, Torque, or Unity. These all have advantages and disadvantages compared to using the standard Objective-C SDK, but really, if it's about the language itself, it's hard to see how you would be better able to "stand" the languages supported by these three than Objective-C.