I did tweaked the allocation in the singleton implementation, but when I made two different subclasses of the singleton, namely Batman and Superman, only the first one instantiated ever. Whenever I tried to send a message to Superman, Batman tried to respond (without such a method resulting in crash). I’ve profiled it, showing the same result, only a Batman instantiated once.

I’ve came up with a solution that adds an additional condition to singleton allocation:

if (sharedInstance == nil || [sharedInstance isKindOfClass:[self class]] == NO)
sharedInstance = [NSAllocateObject([self class], 0, NULL) init];

Seems a bit weird at the first sight, but this solved the problem. You may file an errata on this.

I’ve shared the whole class with many more tiny addition out of the scope of this post (multi-delegates, really weak delegate messaging with variable parameter count, hidden interface from clients, visible for subclasses, and more) at https://eppz.svn.beanstalkapp.com/eppzkit/

Thanks for the book, I really love it.