iPhone SDK restrictions

I finally downloaded the iPhone SDK and I’ve been exploring it all day. However, the license has some serious restrictions which may affect our ability to develop our product for the iPhone. In particular:

3.3.1 Applications may only use Published APIs in the manner prescribed by Apple and must not use or call any unpublished or private APIs.

3.3.2 An Application may not itself install or launch other executable code by any means, including without limitation through the use of a plug-in architecture, calling other frameworks, other APIs or otherwise. No interpreted code may be downloaded and used in an Application except for code that is interpreted and run by Apple’s Published APIs and built-in interpreter(s).

It also appears that we won’t be able to develop an invisible background application without violating the license.

Don't ever do this

I’m debugging a piece of code (which I didn’t write) that acts as a specialized web server when I found a little gem (more like a turd). When a system call fails, it simply calls exit(0) to quit immediately with no error message and no attempt to recover. Argggh!

Making money with freeware

David Watanabe came up with a great idea to make money on the new free version of NewsFire: include three paid-for feeds that the user cannot unsubscribe from. Site owners can bid for a spot as one of these feeds, bringing Watanabe revenue while offering a great product for free.

Recently there was an uproar when David added affiliate links to Inquisitor, his Safari search plugin. It was actually a good move, since it allows him to distribute his software for free, while still making money from it. Everyone wins – we all get a good product and David gets paid for his effort. Most people don’t pay for shareware, so this sponsored model is a good alternative for many developers. I’m sure many people would rather use ad-supported software with full functionality instead of limited demo versions.

It’s nothing new. Eudora used his same model many years ago. You could use it in one of three modes: a sponsored mode with full functionality although it displayed ads; a lite version that didn’t show ads but eliminated functionality; and a paid version that had full functionality with no ads. Twitterrific is doing the same thing now. It’s fully functional but displays unobtrusive ads, although you can pay to eliminate those ads.

Is Assembly Language programming an obsolete skill?

Obsolete Skills is a wiki inspired by Scoble’s recent post listing “things we used to know that no longer are very useful to us”.

One of the “obsolete skills” listed on the wiki is assembly language programming. Although most programmers won’t write an entire application in assembly language, it’s still a very useful skill for several reasons.

Being able to understand assembly language is essential for effective debugging. Looking at the generated code in the debugger gives an extra depth of understanding how the application actually works and what’s really happening. Seeing the register contents and the last instruction executed will give important clues about why it crashed.

Even with faster processors, there are still times when it’s important to squeeze out the highest possible performance, such as games or graphics-intensive work. In many cases, the only way to do it is to recode some inner loops or frequently executed code in assembly language.

I don’t think assembly language programming will become obsolete any time soon.

Trouble with case-sensitive file system

One of our customers was having a strange installation problem after upgrading their Mac from 10.4 to 10.5. It turns out they reformatted the drive as a case-sensitive file system. During the installation, a utility gets downloaded from the server. The installation process specifies a pathname to execute that utility, which doesn’t match the case of the actual filename.

We’re in good company, though. A lot of applications including Photoshop CS3 won’t install on a case sensitive volume.

Permission problems

Repairing permissions is considered the Mac equivalent of snake oil or waving a dead chicken. It’s usually the first thing suggested for fixing problems, although in most cases it does nothing. There are a few rare problems that it actually does fix, and I encountered one of them today.

One of our customers has been having trouble installing our software on a certain group of machines. For the last week or so we were completely stumped. When I finally got access to their machine today I discovered that /Library/Frameworks had the wrong permissions.

On all of my machines, the permissions are 0775 (drwxrwxr-x), and owned by root:admin. On these particular machines it was set to 0755 (drwxr-xr-x). During the installation, a system specific module gets downloaded from the server and installed in that directory. Because of the incorrect permissions, that was failing. It turns out that the VPN software they installed was setting the permissions incorrectly.

New LoJack Release

We released a new version of LoJack for Laptops today. One of the major changes in this version is a new installer. Instead of using Apple’s installer, this is a full Cocoa application which handles user registration, assigns a serial number through a web service, and ensures that it’s calling successfully. This is the major project I’ve been working on for the last few months.

Backward Compatibility

As a developer, my least favorite thing is having to maintain backward compatibility with older systems. It keeps me from being able to use the latest features and I often have to have some code duplicated to do things differently depending on the OS version.

For example I’m using the new, preferred method with launchd to run items when the system is booted. Unfortunately that only works in OS X 10.4 or later, so I just had to add some extra code to maintain compatibility with 10.3 using an old fashioned StartupItem. Of course this also makes QA testing a lot more difficult, since we have more different systems to test with.

Thankfully we’re dropping support for 10.2, which makes it a little easier.

Lesson of the day

When writing Objective C code, never forget to have your init method return self or bad things will happen, but maybe not in a debug build. I wasted over an hour on that today when my debug build worked perfectly but a release build crashed in awakeFromNib where it was initializing a series of items for a TabView. One of them had an init method that looked like this:

- (id)init
{
	if (self = [super init]) {
		[self loadStateNames];
	}
	// oops - I forgot something here
}


For some mysterious reason it didn’t fail in a debug build, and I couldn’t place a breakpoint to debug a release build, so I had to resort to “ghetto debugging” using CFShow. Instead of a panel object, I was seeing an array of state names! Adding return self; cured it.

My2unz.com Improvements

I’ve made a few improvements to my2unz.com over the weekend. I set up several color variations of the theme, and enabled theme switching. I also did some work on the iTunes module and changed the database tables slightly to add a few new features.

One of the problems with the previous version is that I considered the track title, artist name and album title to identify identical tracks. However, if two members owned the same track but on different albums (for example “Stairway to Heaven” from IV in one member’s playlist and from “Best of Led Zeppelin” in another one), they won’t be recognized as the same track and won’t count in number of fans for that track. I dropped the album info from the track table and moved it to the playlist info table, so it’s still listed in a member’s playlist.

You can now click on a track to see more info and rate that track. In the track lists and track info screens you can click on the artist name to see a list of all tracks by that artist.

There are also new items in member profiles to list all playlists and all tracks owned by that member.

Finally, I’ve added the Content Recommendation module, which will recommend artists, tracks, and playlists based on ratings.

My2unz.com is still in private beta, but anyone who wants an invite can contact me or another member. When it goes public I will enable Drupal distributed authentication and possibly OpenID.