Hacker News new | ask | show | jobs
by mikeash 4915 days ago
The suggestion that "+initialize is great for registering NSURLProtocol, NSValueTransformer, and NSIncrementalStore subclasses" is, alas, off the mark. If you use +initialize for anything that needs to be registered before it gets used, you'll end up with a chicken-and-egg problem, because +initialize doesn't run until the class's first use. +initialize is great for one-time setup of class-wide data, but it doesn't work for registering classes with the system when the act of registering is the only thing that causes them to be used.