Best mac questions in January 2011

Can you use MacRuby to develop applications for the Mac App Store?

10 votes

I have some basic familiarity with Objective-C, but prefer Ruby, so I'm thinking of playing around with MacRuby. Is it possible to use MacRuby to develop applications for the Mac App Store, or do I have to use Objective-C? (Note that I don't care so much about iOS/the iPhone and iPad store right now, just the Mac OS X app store.)

This comes up sporadically; beyond the guidelines that @NSResponder mentioned, the reality is that you'll just be spending a lot of extra & unnecessary time if you decide to use MacRuby unless you plan on using some large chunk of already written Ruby code in your app.

Learning Objective-C is about 2% of the overall learning needed to be an effective Cocoa developer. The other 98% is everything from memory management model to standard idioms like KVC/KVO/delegation to NIB files to the myriad of classes & APIs throughout the system.

All of those things are written in Objective-C (or C) with documentation targeting Objective-C and examples written in Objective-C.

As well, the entire tool chain is focused on validating, compiling, indexing, debugging, and manipulating Objective-C.

If you want to use MacRuby to build a real Cocoa app, you are going to have to know Objective-C through and through anyway. And you are going to have to deal with whatever bugs and impedance mismatch is in the bridge layer, too.

port an iOS (iPhone) app to mac?

8 votes

Is there a preferred way to go about this?

The app in question is not too large . . . single-player game that I wrote over the course of a couple of months.

EDIT: I should add that I have no experience with mac development . . . outside of what comes naturally with being an iOS developer.

EDIT: Classes heavily used in the game: subclasses of NSObject, UIView, and UIViewController. I don't know much about NSView, but I'm pretty sure all the UIView stuff will work in that class. Also some use of UITableViewController. I do also have Game Center, but I can leave that part out for now. There is no multi-touch.

EDIT: My graphics is all stuff that is in the QuartzCore and CoreGraphics frameworks. I do have a moderate view hierarchy.

EDIT: If you are doing such a port, you may also be interested in the issue of memory management

  1. there's no easy way. depressingly, you simply have to "become good at programming the Mac"

  2. "I'm pretty sure all the UIView stuff will work in that class" -- probably not, unfortunately. everything is different that enough you have to work pretty hard.

It's not a fun gig. Make sure you really, really think it's worth it financially. Could you just do another four fone apps in the meantime?

Be aware of the infamous "sibling views don't work on OSX" problem if you stack up a lot of views in your iOS app. Essentially, you will have to change to using layers (instead of simply views) on the Mac if you rely on nested hierarchies of views here and there on the fone!

Click this link: Is there a proper way to handle overlapping NSView siblings? for the gory details on that particular problem!