views:

9

answers:

1

I'm using cocos2d with objective C.

I have a class called CrystalineBubble that is currently empty it inherits from CCNode.

#import <Foundation/Foundation.h>
#import "cocos2d.h"

@interface CrystalineBubble : CCNode {



}

@end

When I try to create an instance of that class and alloc it I get the warning 'CrystalineBubble' may not respond to '-alloc'

here is the line of code where I create and call alloc.

CrystalineBubble* crystaline_bubble = [[crystaline_bubble alloc] init];

I have imported the CrystalineBubble class. The pointer crystaline_bubble isn't being allocated any memory, after stepping over that line it still points to 0x0.
I know I'm doing something incredibly stupid here I just can't spot my error.

+2  A: 

This line is incorrect:

CrystalineBubble* crystaline_bubble = [[crystaline_bubble alloc] init];

It should be:

CrystalineBubble* crystaline_bubble = [[CrystalineBubble alloc] init];

+alloc is a class method, not an instance method.

Rob Napier
I'm an idiot, I knew it was just something really simple I wasn't seeing. Thanks.
Tiddly

related questions