What challenges are there in making an iPhone IDE for Windows/Linux? - objective-c

First of all, is this possible?
If so:
What challenges would I encounter in making an XCode imitation for iPhone/iPod development for Windows or Linux?
I was thinking about using gcc as the actual compiler for the objective-c and (VB).NET for the IDE. Will that work?
It doesn't need to compile to iPhone OS until it is to be tested on the device or submitted to the app store. Perhaps it will be easier to compile to the local OS format (Windows or Linux) until "prime-time".
Is this concept possible? Comments? Ideas of how to implement?

If you wanted to support all of UIKit and Cocoa Touch, the problems would be insurmountable. You'd spend 2 years trying to get off the ground and then give up, while everyone else had fun developing apps for the iPhone and iPad and other devices. You would regret even trying it.
But if you wanted to create your own framework for making iPhone apps, built immediately on top of OpenGL, it might be possible. You would create a simulator that renders to an OpenGL view, and the final app would also render everything in an OpenGL view, touching none of UIKit. You would use pure C, or some robust cross-platform language like Lua, compiled or even interpreted. Incidentally, that's more or less how the Corona framework does it: built on top of OpenGL, touches little of the iPhone SDK, uses compiled Lua. They developed their own simulator, which only runs on OSX, but could probably relatively easily be ported to Linux.
You could even use Objective-C as the language, and make available a carefully chosen subset of the Cocoa API's by using (the iPhone compatible parts of) GNUstep Base. Then users could use standard classes like NSString.
Still, all of this is mostly interesting as a thought experiment, unless you got a team together to work on this as an Open Source project. It's harder than you think. Your simulator wouldn't be able to emulate the way that memory warnings are generated on the iPhone, for example.
If someone wants to develop iPhone apps on Linux, it makes more sense to just write the whole app in C/C++ using OpenGL, and then basically just smack that code onto a vanilla iPhone OpenGL project. That's the fastest path. The next possibility would be to use another language, which is also not too hard. But an "iPhone IDE" on top of that would be little more than putting an iPhone-like frame around the OpenGL view in Linux.

Actually, Felixyz touched on something your should take a look at. See: http://www.gnustep.org/ . They have binaries for just about every variant of *nix, OS X, and windows. The site claims "GNUstep seeks to be source code compatible with Cocoa and OpenStep, it can thus be used to develop and build cross-platform applications between Macintosh (Cocoa), Unix and Windows." It would be a good jumping off point for such a project,
I doubt all OSX's functionality is covered by GNUStep, but it's a start.
I'd imagine to develop iPhone/iPod apps on an alternate platform, you'd need to get Apple's includes (Legality is likely to be an issue), and apply all their toolchain patches, plus a million other things I'm probably overlooking.
What would be a better project is implementing the missing functions in GNUStep to support OSX apps seamlessly under the host platform. Maybe then you could run xcode native on your desired OS.

Related

Utilizing resources of separate apps on OS X

Is it possible to write software on the mac that will launch other separate applications, tell them what to do, etc etc? What language would best suite doing this? (Assuming it's Mac specific).
I'm fairly new to Mac programming, though I have a strong background in iOS. I've seen multiple companies in the past write a script that will cross-compile source code, basically you run your app from the Terminal and it floats around your OS, grabbing what it needs to compile and spits out an Xcode, Eclipse and Unity-ready versions of your source code. I'm familiar with iOS, and how it crashes the second you try to use another apps resources. That is what leads me to the original question:
Is it possible to write software on the mac that will launch other separate applications, tell them what to do, etc etc? Specifically tasks like launch Safari, take a screenshot, launch disk utility, launch mail, email screenshot. I know that OS X allows you to play around a bit more than iOS, but the question is how much.
It's still rather up to what each app will let you do, rather than just being able to do anything, but take a look at OS X's scripting/automation abilities. Primarily this is accessed through AppleScript, but there's now a JavaScript frontend as well (new to Yosemite).
If you're looking at building a native application that takes advantage of other applications, the same scripting abilities can also be reached via the Scripting Bridge from Cocoa (Objective-C/Swift).

Porting an iOS app to OSX and maintaining one code set?

I'm an experienced iOS developer but have not touched OSX development. I plan to port my iOS app to OSX. Of course, there will be certain differences based upon the obvious design paradigm and differences in SDKs, but I could easily see 80-90% of the code being identical, even including a lot of the UI. Is there any good approach for maintaining one code set that powers both apps? Of course, I could do some sort of static library, but I'm wondering if there is a complete solution, and/or advice on what pitfalls I might encounter as a new OSX developer...
Check out http://chameleonproject.org/, "a drop in replacement for UIKit that runs on Mac OS X".
Alternatively, you could have two different targets in your Xcode project, one for iOS and the other for Mac, then include the overlapping code files in both your iOS and Mac targets.

porting from ios to windows

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++.

How do you write program for Mac OS X?

Hi just wondering how do you start writing programs for MAC OS X?
what language does it use? can I use objective C? which IDE do I use? any licensing fee should I know about.
Thanks.
Mac OS X is a great programming platform, as such you can use just about any language you like.
If you wish to write native applications using the Cocoa framework you'll probably want to be using Objective-C. You can download XCode as an IDE for free.
No licensing fees.
Xcode is the apple supplied IDE, and without external libraries some objective C is always required to build applications.
That being said xcode supports multiple types of langauges, and has extensions for many more - and C++ can be spliced in with objective C code - so if you prefer to code in C++ you can write a quick objective C wrapper and do all your own stuff in C++ - or indeed the langauge of your choice. There are a few other open source IDE's but I don't really recommend them - most of them crash on opening in new versions of Mac OS X.
Xcode is found in the developer package on your second mac install disk, or the latest version (with iphone SDK's) can be downloaded once registering on the Apple Developer Website, which you can become a basic member of for free.
As far as licensing goes, unless you plan to make a game for iOS there are no liscensing fees, unless you want a full subscription to apples developer website, which gives you a few extra things from them.
If your trying to write a game, consider using the SDL library, a cross platform wrapper for whole lot of operating system interface functions, including graphics - or you can use it as I do in combination with OpenGL for full 3D Support, hardware acceleration, ect.
Objective-C + Cocoa
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Introduction/introObjectiveC.html
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaFundamentals/Introduction/Introduction.html
Apple suggests XCode
The native libraryfor OS X developed by Apple are called Cocoa. It provides OS X's graphical user interface, and other libraries such as Core Data for database acess, Core Animation for fast easy animation and video features in your software. These libraries are written in a mixture of C and Objective C (which is an extension of the C language). For best performance and best integration with the Mac operating system you should probaby look at developing in C, Objective C and perhaps some C++ as well.
There are some add-on layers that provide acces to the Cocoa libraries from other languages such as Ruby or Python. These are generaly of good quality and work well, so you can use these languages if your aplication does not need the very best performance. They are generaly considered to be easier to learn than the C family of languages and you can become productive very quickly.
Beyond that, you can use languages and toolkits that are platform-independent so your software will can run on Linux or Windows as well as the Mac. For example Python comes with a simple built-in GUI toolkit called Tkinter. You can use more powerful cross-platform toolkits such as Qt or WxWidgets with C or C++ but have excellent bindings for Ruby, Python and other langauges. This is an approach I am using of a project, with Python and Qt.
Others have mentioned Apple's integrated development environemnt (IDE) called XCode. I have only toyed with it, but it looks very powerful for true native development of Cocoa applications.

Qt4.5 vs Cocoa for native Mac UI

I've been developing for Windows and *nix platforms for quite some time, and am looking to move into Mac development. I am tossing up between using ObjC/Cocoa and C++/Qt4.5.
The C++/moc semantics make more sense to me, and improving knowledge in Qt seems like a sensible thing to do given that you end up with a skill set that covers more platforms.
Am I likely to handicap my applications by skipping Cocoa?
The sample Qt applications look pretty Mac-native to me, but they are quite simple so potentially don't tell the whole story. Are there other pros to the Xcode way that Qt doesn't have, such as packaging, deployment, etc.?
Here's an easy way to answer it:
If you were developing a Windows app with .NET or MFC, would you handicap your applications by using Qt? If the answer to that is yes, then the situation is likely to be the same on the Mac.
A few negatives I can think of off the top of my head:
Licensing
Qt apps, while good, are not completely a native UI experience and there's things a native UI designer can do in Cocoa which boggle the mind. While I can't be sure that all the same functionality isn't available in Qt, I doubt it.
Qt is always a little behind. If Microsoft or Apple come out with a great new technology, you have to wait for the Qt developers to update Qt.
However, with all that said, only you can determine the business value of using Qt. If you think cross-platform development is going to be a major part of your development, then Qt might be worth it, despite the issues mentioned.
Ask yourself: how many of the best Mac applications that you know of use Qt instead of native Cocoa?
For our robotic systems, we originally wrote our control software in C++ using the cross-platform wxWidgets library (we avoided Qt due to some licensing concerns), because we felt that we had to target Windows, Linux, and Mac platforms for our end users. This is what we shipped for over a year until I started tinkering with Cocoa.
Right away, the thing that most impressed me was how quickly you could develop using Cocoa. Eventually, we decided to drop support for Linux and Windows and rewrite our entire control applications in Cocoa. What had taken us years to put together in C++ required only three months to completely reimplement in Cocoa.
Aside from the "lowest common denominator" interface issues that others have pointed out, the rapid development allowed by Cocoa has become a competitive advantage for our company. Our software has advanced far more quickly since our conversion to Cocoa, and it has allowed us as a new company with one developer to pull even with 10-year-old competitors that have 20-man development teams. This appears to be a common story in the Mac development space, where you see a lot of small teams who are able to create products that compete with those of much larger companies.
As a final note, using Cocoa gives you the ability to stay on top of the new APIs Apple is continually rolling out. We're now working on a new control interface that will make heavy use of Core Animation, something that would be painful to deal with using Qt.
I'm currently developing both with QT (actually PyQT, but it makes no difference to your question) and native Cocoa app. For me it's no brainer, I'd chose Cocoa. It's really worth time to explore Cocoa in general, there are many great concepts within the Cocoa framework, and Objective-C 2.0 as well.
I'd use Qt if you want this to be a crossplatform application.
You can have a look at the QMacCocoaViewContainer class. It acts as some kind of wrapper for generic Cocoa views, so you can also have Cocoa elements which are not officially supported by Qt.
Of course this means learning a little about Cocoa and Objective C and how a Cocoa UI would need to look like. But if you already know Qt well and if it’s not like your application is all and only about the GUI this could be a good way to go.
And don’t forget about the QMacStyle::WidgetSizePolicy or you won’t understand why your tables come out so huge.
Obviously, the best option is to use a cross platform suite that supports native widgets.
With QT4 you can build your base user interface. Then just add native support for your specific target platform.
Sure, Cocoa has a lot of fancy stuff (and you can still use them trough QT4), but let me be clear. I see a lot of fancy Apps on the AppStore, pretty ones, but most of then are just crap, expensive.. what ever. I really missed my Kate text editor, my okular viewer, my krita drawing software... those are just better than the commercial and expensive alternatives and are free. so i just tweak the source code a little bit too have a REAL native and great experience.
What if i have to use a linux app on my main computer with is a mac os x? or windows? or whatever? only?
For example, why on earth i have to buy a expensive ,fancy but far less featured image editor software for my mac like pixelmator when i can use a full featured real image manipulation software like Gimp? YES Gimp is gtk2 based which is a pain on any platform, specially on Mac because is really ugly. Gimp should be ported to QT4. Inkscape should be ported to QT4 too, and it would feel so great.
Is so simple to do.. gosh!
http://doc.qt.nokia.com/4.7-snapshot/demos-macmainwindow.html
Even you can add support for the the new native lion fullscreen feature, unified title and toolbar menus, etc
I , as a user, i really care about efficient, featured, good and cross platform apps, i don't really care about developer's convenience or laziness .
I do a lot of cross-platform development (Mac, Windows, Linux), and for some projects use Qt. It is a fine framework, and provides a rich class library. If you need to deploy on multiple platforms, cannot afford to spend the time/effort on platform-specific front-ends, or the "generic" support for each platform is sufficiently good, then use Qt.
However, Qt inevitably suffers in some ways from the lowest common denominator syndrome, and sometimes does not feel quite native enough. There are also certain features that are either difficult to support, or are simply not provided in the Qt libraries. So if you can afford the time and effort, or your app really demands the attention to detail and fit & finish, then developing separate front-ends may be worth it.
In either case, you ought to be writing your back-end (aka domain) code in a platform-neutral and front-end neutral manner. This way, the front-end is easily replaced, or modified between platforms.
You could always start with a Qt front-end and go for a quick time to market, then develop a native front-end down the line.
In practice, I've noticed that a Qt app on Windows looks most "native", while on Mac there are certain subtle telltale signs that make it look/feel not quite right. And Mac users tend to have much higher expectations when it comes to UI/UX!
Since posting this, i've been learning the Cocoa / Objective-C way, and have been quite impressed. Despite what I initially thought was quite a quirky syntax, Objc appears to be a very effective language for implementing UI code, and the XCode sugar - things like Core Data and bindings - make short work of all of the boring bits.
I spent a while with the QT examples and documentation before digging into cocoa, and tend to agree with what has been said above w.r.t being slightly behind the curve and less 'aqua-ish' - albeit from a fairly trivial inspection. If I absolutely had to be build a cross-platform app i'd probably use QT rather than trying to separate out the UI code, as it seems like it would provide close-enough visuals, but for mac only purposes, Cocoa seems like a definite win.
Thanks all for your responses, they've all been very helpful!
DO NOT use Qt for a Mac app. You will get no hardware acceleration for 2D rendering, and you will not be able to deliver ADA compliance.
Depending on what kind of apps you want to write, another contender is REALbasic now called Xojo.
The move from C++ is pretty easy (I have 15 years C++ experience) and the framework and IDE extremely productive. You have the added bonus of being able to deploy to Linux and Windows with trivial effort. Their framework compiles to native code and uses native widgets so you don't have an emulated look and feel.
The big reason for learning Cocoa and coding in Objective-C is if you want to hone your iPhone skills or are chasing a really fancy user experience. If you wanted to rival the cutting edge of WPF development then I'd recommend Cocoa.