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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to