Hey guys, this is a real noobie question so please bare with me. I'm 100% new to Mac, only had this macbook for a week. I want to get into IPhone dev and here I am. I've been writing code for c/c++ windows applications for some time now so i'm not a coding noob, just obj-c
Anyway, here is my question.
I'm trying to allocate memory for a near empty class. But its crashing on the alloc function... here we go..
Sprite.h file
Code:
@interface Sprite
{
@private
bool m_init;
}
- (void)draw;
@end
Sprite.m
Code:
#import "Sprite.h"
@implementation Sprite
- (void)init
{
m_init = TRUE;
}
- (void)draw
{
}
@end
ELGLView.m offending code
Code:
if( !m_init )
{
m_sprite = [[Sprite alloc] init];
m_init = TRUE;
}
I have m_sprite decleared in the ELGView.h file. When I compile i get a waring saying:
Warning: 'Sprite' may not respond to '+alloc'
I'm not sure what that warning means either, but i'm sure it has something to do with my crash. When i rush i through the Iphone simulator it crashes and asks if i want to reload.
When i step through the code it comes up to the
Code:
m_sprite = [[Sprite alloc] init];
line and the callstack says its finished in __forwarding__
Looking at tutorials it appears to be correct, but there might be something very simple that i've forgotten somewhere. Any help would be greatly appreciated.