Subscribe ( )

iPhone Programming Tutorials


 

Forum

You must be logged in to post Login Register

Search 

This is probably simple

User Post

2:56 am
September 2, 2008


JuncoPartner

Noob

posts 2

1

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] initWithName:(NSString *)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.


1:36 pm
September 2, 2008


Admin

brandontreb

posts 88

2

are you synthesizing your properties?

If debugging is the process of removing bugs, then programming must be the process of putting them in.
-Edsger Dijkstra

1:40 pm
September 2, 2008


JuncoPartner

Noob

posts 2

3

Thanks for the reply Brandon. I was actually about to post up that I got it working. And you were correct in your train of though. I was synthesizing alright, but obviously not using the synthesized property to instantiate the variables. I've fixed that and the code is working perfectly now.

Stuff like that has been killing me, coming from a .net background but it's nice to learn!

Search 

About the iCodeBlog forum

Most Users Ever Online:

44


Currently Online:

4 Guests

Forum Stats:

Groups: 2

Forums: 6

Topics: 419

Posts: 893

Membership:

There are 934 Members

There has been 1 Guest

There are 2 Admins

There is 1 Moderator

Top Posters:

bobcubsfan – 54

crazyiez – 30

Uhu – 17

AdeC – 17

Nick – 15

jitesh61 – 12

Administrators: Brandon (88 Posts), Collin (0 Posts)

Moderators: VertigoSol (26 Posts)



©   

  • Posted by on 6 Aug 2008 in Uncategorized
  •   |  
  •   |  
  •   |  
  • Comments Off

Comments are closed.