accessing unknown 'myvar' component of a property

Discussion in 'iPhone/iPad Programming' started by skunkio, May 6, 2010.

  1. macrumors newbie

    Joined:
    Apr 25, 2010
    #1
    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è
     
  2. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    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.
     
  3. thread starter macrumors newbie

    Joined:
    Apr 25, 2010
    #3
    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è
     
  4. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    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.
     

Share This Page