Re: Please help..... NIL Object problems...
Re: Please help..... NIL Object problems...
- Subject: Re: Please help..... NIL Object problems...
- From: Graham Wihlidal <email@hidden>
- Date: Wed, 1 Aug 2001 03:01:19 -0600
Hmmmmm. Difficult to say... how and when the 'window' variable is
filled?
Looks to me that when you call the display method from outside, you
skip the
initialization (which fills the variable) somehow.
I have the variable declared by an instantiated class in IB which has an
appropriate outlet, and in the class source header file it is declared
like so
Here is the source:
GSSLSocket.h
*********************************************
#import <Cocoa/Cocoa.h>
@interface GSSLSocket : NSObject {
NSWindow* connectStatusWindow;
}
+ (GSSLSocket*)sharedGSSLSocket;
- (void)displayConnectStatus:(id)sender;
@end
GSSLSocket.m
*********************************************
#import "GSSLSocket.h"
GSSLSocket *mainGSSLSocket = nil;
@implementation GSSLSocket
+ (GSSLSocket *)sharedGSSLSocket;
{
if (mainGSSLSocket == nil)
mainGSSLSocket = [[self alloc] init];
return mainGSSLSocket;
}
- (void)displayConnectStatus:(id)sender
{
[connectStatusWindow center];
[connectStatusWindow makeKeyAndOrderFront:self];
}
@end
Calling this method (displayConnectStatus:nil) works fine in this source
file, but calling:
[[GSSLSocket sharedGSSLSocket] displayConnectStatus:nil]; does not work
The class instance is created correctly because I tried adding an NSLog
to the method and calling it the above way and it does indeed fire. It
just doesn't have a set variable to work with.
I would really appreciate some help.
Thanks,
Graham