• 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: Using CLI arguments in controller (scoping?)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Using CLI arguments in controller (scoping?) (From: Andrew Pouliot <email@hidden>)

  • Prev by Date: Re: Should objects returned by indirection be autoreleased
  • Next by Date: Implementing -willDisplayCell... delegate method for NSMatrix
  • Previous by thread: Re: Using CLI arguments in controller (scoping?)
  • Next by thread: compressing an NSString
  • Index(es):
    • Date
    • Thread