In one of my previous posts, I outlined an idea for an application that would allow the current song on a mobile device to start playing on the user's computer. After some thought I decided to take the plunge and write it up. The current incarnation is made up of two parts: an iphone/ipod touch app and a cocoa server that runs on the users pc. You can check out a short demo of the system here. Below is a run down of the design, as well as my thoughts on the development experience.
The system is made up of two parts, a cocoa based server on the users computer that talks to iTunes, and the iphone/ipod touch app that obviously runs on the device. Initially, I thought I would handle the the communication between the two components via http. I would embed an http server in cocoa desktop app, and then the mobile application would make HTTP requests to the server, indicating what the current track,artist and elapsed time were. After putting some thought into it, I decided this would be the wrong way to go. The reason I decided against this is that it would require configuration on the users behalf. The user would need to configure the mobile app with the name of the machine the server is running on. Not that big of a deal, but unnecessary configuration isn't very Apple like, now is it?? ;) My next kick at the can was to make use of the Bonjour protocol. Bonjour is a zero config way of publishing networking services. Perfect, zero configuration, thats more like it... Once I settled on Bonjour, I actually integrated it into my project by using the real cool MyNetwork library. It makes using Bonjour on both the client and server side a snap.
On the device side, the application listens for a shake event, sends a message to the server, and performs a little animation to indicate to the user whats going on.
During the process of designing this project, I really enjoyed working with the cocoa/objective-c APIs on both device and OSX side. I think for me, alot of it has to do with working with objective-c. I had dabbled in it before, so the syntax wasn't too weird for me. I really liked the named arguments, the dynamic nature of the language, and the whole message passing philosophy. Also, Apple has done a great job of providing well designed and useful APIs along with good documentation on how to use the APIs. I've just scratched the surface too, there tons more Apple provided APIs that appear to be just as much fun to work with.
One thorn in my side was dealing with testing, and getting the code on to my ipod touch. First certain things, like the MPMusicPlayerController, can only be tested on the actual device. Well to test on my own device, I needed to pay the $99 to join the developer program. I thought that I would only need to do that if/when I would want to publish to the app store.
Finally, I am not sure if I am going to try to publish this to the app store or not. I'm not sure if anyone else would find it useful, other than myself. However, I think I'm leaning towards trying to get it in there, especially since I paid the $99 :). If thats the case, the server app needs a little more polish, and right now only works on OSX. I would like to get a windows version, so if you know of any good C# Bonjour implementations, let me know!
Also, feel free to leave comments with any feedback/suggestions you might have.
PS, a big shout out to Sarah and Martin for suggesting to me a very creative name!