title: iPhone, how do usa an App Delegate variable so it can be used like global variables?
body: <p>Heres the code I'm using, see my error afterwards</p>
  
  <pre><code>@interface MyAppDelegate : NSObject  {
    NSString *userName;
  }
  @property (nonatomic, retain) NSString *userName;
  ...
  @end
  </code></pre>
  
  <p>and in the .M file for the App Delegate you would write:</p>
  
  <pre><code>@implementation MyAppDelegate
  @synthesize userName;
  ...
  @end
  </code></pre>
  
  <p>Then, whenever you want to fetch or write userName, you would write:</p>
  
  <pre><code>MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
  someClass.someString = appDelegate.userName;  //..to fetch
  appDelegate.userName = ..some NSString..;     //..to write
  </code></pre>
  
  <p><strong>warning: type 'id ' does not conform to the 'MyAppDelegate' protocol</strong></p>
  
  <p>What am I missing in my code ?</p>