0

I've got an NSObject Ive set up controlling a couple of NSWindows. One of these NSWindows contains a custom NSView. I need to tell the NSView to run a method however the view will not do this. Xcode 2.5 tells me that the object may not respond to the method that I have called for, here is the code:

MenuController.m

#import "MenuController.h"

int gameOn = 0; //variable for if the game is running ATM

@implementation MenuController

-(void)playIt{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    [NSThread detachNewThreadSelector:@selector (callGameView) toTarget:self withObject:nil]; //make a new thread for the game window
    if (gameOn == 0){
        [menuWindow orderOut:self];
        [NSApp activateIgnoringOtherApps:YES]; //set up the game window as the visable window, set focus on it
        gameOn = 1;
        [gameWindow makeFirstResponder: MainView];
        [gameWindow makeKeyAndOrderFront:self];
    }
    while(gameOn != 0){ //initiate the game loop
    //the game loop
        [self callGameView];
    }
    [pool release];
}

-(void)callGameView{ //call for the game loops primary interactions with the game view
    [MainView gameLoop];
}

MenuController.h

#import <Cocoa/Cocoa.h>
#import "GameView.h"

@interface MenuController : NSObject {

    IBOutlet id menuWindow; //outlet for this window (show hide, ect)
    IBOutlet id gameWindow; //the games window
    IBOutlet GameView *MainView; //the game view


}

GameView.m

-(void)gameLoop{
    NSLog(@"Its ALIVE!");
}
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Jobalisk
  • 728
  • 1
  • 6
  • 17
  • Are you really using Xcode 2.5? The latest (non-beta) version is 8.2.1. – rmaddy Feb 08 '17 at 03:17
  • My hand has been forced let us say and so for the next month or so I've got only an Emac running OSX 10.4.11 with 1GB of RAM, a 40GB hard drive and an Airport 1 card for the time being. So yes I really am using 2.5, however this does not solve my problem. – Jobalisk Feb 08 '17 at 05:07
  • Ok, so after defining the meathod in question in the views header file the warning disappeared meaning that my window controller now knows it exists, however it still refuses to call the meathod and gives me no errors or reasons why. – Jobalisk Feb 12 '17 at 19:51

0 Answers0