Do I need to do this:
+(void)initialize{
...my stuff...
[super initialize];
}
That is to say, if I am over-riding initialize
from the parent class (NSObject
) in my App Delegate, to I need to make sure the super implementation also gets called? Or does that not apply since this is not an instance method?
Just how "safe" is this method? I'm implementing the iNotify library and the documentation suggests adding the setup to this method, but I've not previously used it for anything in the app, and want to know also if it can potentially conflict with something else unexpectedly?
if you have subclasses of this class you better call your code using dispatch_once statement because each sublcass will call this method again
+(void)initialize
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^
{
//Your Code
});
}
See this blog post by Mike Ash for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With