Hi guys,
Sorry in advance if this is an obvious/simple one.
I'm new to objective c but for the most part I'm picking it up ok and enjoying learning the new language.
However I'm having a problem with my test app at the moment that I can't figure out…
// pseudocode
In the ViewController of my view,
In the .h I declare a private var and a property, something like
{
MyObject *_obj;
}
@property (nonatomic, retain) *obj;
in the viewDidLoad I have something like
_obj = [[MyObject alloc] initWithNameNSString *)name];
label.text = _obj.name;
At this point when I debug the object is getting instantiated correctly from what I can see, all the properties get set and then the view label text is set correctly.
OK so a little further on I am handling an event where text is entered into a IUTextField
Within the function I need to do some manipulation on my MyObject _obj, but the object seems to be dead/null/nil
When I debug the application and halt it just inside the event handler, investigating the obj tells me that all the properties are set to “invalid” and of course trying to access the obj then causes the app to blow up.
Has anyone an idea what I'm doing wrong?
Thanks in advance for any help.
Sorry in advance if this is an obvious/simple one.
I'm new to objective c but for the most part I'm picking it up ok and enjoying learning the new language.
However I'm having a problem with my test app at the moment that I can't figure out…
// pseudocode
In the ViewController of my view,
In the .h I declare a private var and a property, something like
{
MyObject *_obj;
}
@property (nonatomic, retain) *obj;
in the viewDidLoad I have something like
_obj = [[MyObject alloc] initWithNameNSString *)name];
label.text = _obj.name;
At this point when I debug the object is getting instantiated correctly from what I can see, all the properties get set and then the view label text is set correctly.
OK so a little further on I am handling an event where text is entered into a IUTextField
Within the function I need to do some manipulation on my MyObject _obj, but the object seems to be dead/null/nil
When I debug the application and halt it just inside the event handler, investigating the obj tells me that all the properties are set to “invalid” and of course trying to access the obj then causes the app to blow up.
Has anyone an idea what I'm doing wrong?
Thanks in advance for any help.