Nilesh Agrawal
Nilesh Agrawal

Reputation: 3042

+load method not getting invoked in iOS?

I am aware that +(void)load method gets called in ios even before the main function. In my case it is only getting invoked with UIView and not with UITextView.

Getting invoked here :

@implementation UIView (SomeMethodSwizzling)
+(void)load{



}
@end

Not Getting inovked here .

@implementation UITextView (SomeMethodSwizzling)
+(void)load{

}
@end

Upvotes: 3

Views: 666

Answers (1)

Rob Napier
Rob Napier

Reputation: 299355

Usual reason is that you're not actually linking the file. Most common cause is that you don't directly use anything declared in it (you sometimes need to pass -objc to the linker to fix that). Another cause is you just forgot to add the file to the target (I see that happen a lot).

Upvotes: 1

Related Questions