[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Categories, NSString and +load

From: Andreas Kostler
Subject: Categories, NSString and +load
Date: Fri, 8 Oct 2010 17:21:05 +1000

Hello everyone,
Please help me on this one. The code snippet below output 

Hence, [NSObject load] gets called, [NSString load] doesn't. 
Can anyone explain this behaviour?
Kind Regards

#include <Foundation/NSString.h>
#include <Foundation/NSAutoreleasePool.h>
static int a = 0;
static int b = 0;

@implementation NSObject (objectCategory)
+(void)load {
 a  = 1;

@implementation NSString (stringCategory)
+ (void)load {
 b = 1;

int main() {
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        NSLog (@"%d", a);
        NSLog (@"%d", b);
        [pool release];

reply via email to

[Prev in Thread] Current Thread [Next in Thread]