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开发者_如何学C '-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.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.
精彩评论