• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How call upper layer function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How call upper layer function


  • Subject: Re: How call upper layer function
  • From: Conrad Shultz <email@hidden>
  • Date: Wed, 20 Apr 2011 11:57:14 -0700

Please: post the actual code you are using, not pseudo code. You are reporting build warnings so I know you have some available. Lines like

> //LeveUp.h only call in a correct place the line:
> // LevelDown *test = [[LevelDown alloc] initWithLevelUp: self];

make it nearly impossible to understand what you are ACTUALLY doing.

Forward declaring classes is not normally necessary in simple situations, but it is also not rare and works fine. This is why we need to see code.

I maintain as well, from my previous message, that you would benefit from some more reading, particularly on design patterns. What references are you using?

--
Conrad Shultz
Synthetiq Solutions

On Apr 20, 2011, at 11:34, Rodrigo Zanatta Silva <email@hidden> wrote:

> Now i remember the problem about this solution.
>
> To this work, LevelUp have to include LevelDown
> and LevelDown have to include LevelUp. (This is a cyclic include and will
> fail)
>
> To solve this, I read in a book to use the @class. I do that.
> LevelUp have a #import "levelDown.h"
> and LevelDown have a @class LevelUp
>
> Now the problem is that any function call cause problem because the compiler
> don't found it.
> In code is thing like this:
> //This is the "LevelUp.h"
> *#include "LevelDown.h"*   //IF I use *@class*, it will have the same
> problem
> @interface LevelUp : UIViewController {
>    LevelDown *levelDown;
> }
> -(void) doSomething;
> @end
>
> //LeveUp.h only call in a correct place the line:
> // LevelDown *test = [[LevelDown alloc] initWithLevelUp: self];
>
> //So, the "LevelDown.h" is
> *@class LevelUp;*
> @interface LevelDown : UIViewController  {
> }
> - (id)initWithLevelUp: (LevelUp *)levelUp;
> @end
>
> //Finally in "LevelDown.m" i have
> #import "LevelDown.h"
>
> @implementation *LevelDown*
> - (id)initWithLevelUp: (LevelUp *)levelUp; {
>     self = [super init];
>     LevelUp* myLevelUp = levelUp;
>     [myLevelUp doSomething];   //Everything work, but this will give-me a
> problem
>     return self;
> }
> @end
>
> In the line that have problem, the XCode will show
>
>   - warning: no '-doSomething' method found
>   - warning: Semantic Issue: Method '-doSomething'' not found (return type
>   defaults to 'id')
>
> But the method is correct. What I am doing wrong?
>
> My problem is a little more complex than a simple line.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >How call upper layer function (From: Rodrigo Zanatta Silva <email@hidden>)
 >Re: How call upper layer function (From: Conrad Shultz <email@hidden>)
 >Re: How call upper layer function (From: Rodrigo Zanatta Silva <email@hidden>)
 >Re: How call upper layer function (From: Michael Dautermann <email@hidden>)
 >Re: How call upper layer function (From: Quincey Morris <email@hidden>)
 >Re: How call upper layer function (From: Rodrigo Zanatta Silva <email@hidden>)
 >Re: How call upper layer function (From: Rodrigo Zanatta Silva <email@hidden>)

  • Prev by Date: Re: NSArrayController & image in column
  • Next by Date: Re: scaling a transformed view
  • Previous by thread: Re: How call upper layer function
  • Next by thread: Re: How call upper layer function
  • Index(es):
    • Date
    • Thread