Re: Using CLI arguments in controller (scoping?)
Re: Using CLI arguments in controller (scoping?)
- Subject: Re: Using CLI arguments in controller (scoping?)
- From: Lester Dowling <email@hidden>
- Date: Sat, 13 May 2006 12:03:49 +1000
On 13/05/2006, at 6:37 AM, Andrew Pouliot wrote:
I'm trying to get options specified on the command line to be visible
in my controller class (instantiated in .nib file).
<snip>
TestController.h:
NSString *defaultSound;
NSString *defaultClassName;
<snip>
When I set a breakpoint in awakeFromNib, and ask GDB what
defaultClassName's value is, it prints out the correct string.
However, the code doesn't seem to be seeing the value, because the
//do something block is never reached. When I declared local variables
right before that section that just copied those values, these got nil
values. I assume that I've screwed something up with scoping.
Try the following. In your header "TestController.h" substitute these
declarations:
extern NSString *defaultSound;
extern NSString *defaultClassName;
And, in your implementation file "TestController.m" place these
definitions:
NSString *defaultSound = nil;
NSString *defaultClassName = nil;
That will then work and the awakeFromNib method will do as expected.
Regards,
Lester
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden