Now Playing Supports Mac OS X Lion and iTunes 10.4

Now Playing2 Comments

On July 20th, Apple released Mac OS X Lion. As a part of this release, they also released iTunes 10.4. Shouldn’t have been a big deal but it was a huge change for plugin developers. From the knowledge base:

iTunes is now a 64-bit Cocoa application on OS X Lion and includes a number of important stability and performance improvements. Some iTunes plug-ins may no longer be compatible with this version of iTunes. Please contact the plug-in developer for an updated plug-in compatible with iTunes 10.4.

Great. Thanks for that one, Apple. So within a few hours I started getting all the emails. “Why doesn’t Now Playing work?”, they would ask. Some asked nicely. Others did not.

Given this plugin is a strongly supported hobby project for me, I don’t work in advance of Apple releasing new software. Its just not a tradeoff I want to make versus my time. However, that just means once they release a change, I have to adapt in a reasonable amount of time. For 6 years, I have done that whether it be a change by Apple, Twitter, Amazon, Facebook, or anything else my plugin uses. I haven’t ever charged for those updates. So goes the cycle again.

I was on vacation at the time of the Lion release so that delayed me. I didn’t have my source code nor Xcode development environment handy. But once that was resolved, I figured I could quickly just change a few project configuration flags to build 64 bit and I would be good. Oh, maybe something else but nothing significant.

Turns out it was significant in many other ways:

1. Apple changed the iTunes API to version 2.0. Previously, the plugin was using iTunes API version 1.2. This API has changed three times now over the course of many years. Its not often but I was surprised to see it. And it was a larger change than normal as also indicated by the bump to version 2. This wasn’t too terrible to adapt to except for the fact that the version 2 APIs were not backwards compatible. So I had to fork things in the code so that pre-10.4 iTunes uses the old APIs and 10.4 and later will use the new APIs. Plugins did not have to deal with this in the past so there was new work to be done there.

2. Apple desupported the Carbon UI framework I was using in 64-bit mode. I sort of knew this day was coming. My original plugin used the Carbon framework for the UI. Being new to Mac OS X development many years ago, I found many articles showing me how to port from Windows-based MFC programs to Mac OS X-based Carbon programs. Carbon was easy to learn and provided everything I needed. Over the years, Apple continued to build and invest in the alternative Objective-C based Cocoa framework. Whenever I looked at Cocoa code, my head hurt. What the heck is “[[window alloc] init]”. Screw that. Stick with what I know. So when Apple moved iTunes to 64-bit, that meant no more Carbon for the UI. So I had to start over. There are no porting tools. You just have to redesign your windows/dialogs one by one. So I did that. Copied the layouts pretty closely. Reimplemented the control logic. All that took many late nights pouring over samples and documentation to figure out how to wire up a Cocoa app. It wasn’t hard. It was just different. And you have to learn something when its different.

3. 64-bit also mucked with a few libraries I used for things like MD5 and HTTP fetches of web pages. So I had to retool those a bit and they are much better now as I found native platform ways to do the same actions in less code. They just didn’t exist years ago when I first popped this sucker out for general consumption.

So all that was completed in the midst of a vacation, business trip, and finalized in a tent during a rainstorm while on a camping trip with my kids. I enjoyed doing all of it and I am glad to have Now Playing back in service today. Its working well for me. I have tested on Lion and Snow Leopard with combinations of iTunes 10.3 and 10.4. It might not be perfect yet but surely we can tackle those bugs as we find them together.

Sssssh…I also freed up the Facebook Rate Limit.

Download the update here.