Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

skunkio

macrumors newbie
Original poster
Apr 25, 2010
28
0
Hi all,
i'm getting this error during the build of my app following the code below.
I have 3 classes:

ClassA (UIViewController)
ClassB (UIViewController)
ClassC (NSObject)

Inside ClassA i have a property defined as ClassB.

Code:
@property (nonatomic, retain) ClassB *B;

ClassB has a property defined as ClassC.

Code:
@property (nonatomic, retain) ClassC *C;

ClassC ha some properties inside

Code:
@property (nonatomic, retain) NSString *Prop1;
@property (nonatomic, retain) NSString *Prop2;

The error is inside ClassA on the line:

Code:
txtTest.text = self.ClassB.ClassC.Prop1;

in this same class i initialize ClassB as per follow code

Code:
self.B = [[ClassB alloc] init];

How can i use ClassC properties whitin ClassB?

Ciao,
stè
 

skunkio

macrumors newbie
Original poster
Apr 25, 2010
28
0
Start by not referencing your ivars by their class names.

Perhaps it is time for you to step back from the real coding and go (re)learn the basics of Objective-C.

I'm pretty new with objective-c, maybe there is more than one thing i have to re(learn).
Which section, basics of Objective-C, you think i have to investigate to understand what i'm doing wrong?

Ciao,
stè
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
Which section, basics of Objective-C, you think i have to investigate to understand what i'm doing wrong?
I would suggest not thinking of it in terms of what you have to learn to fix what's wrong but instead what you need to learn to gain a basic understanding of the language and how to use it. Put away any real code you are working on. Get a book or take some tutorials or watch some videos and start coding from the ground up.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.