title: Why does 'self' protect memory space?
body: <p>In a navigation based app, I initialize an array in my app delegate without using self. When accessed in the RootViewController's cellForRowAtIndexPath:, all array objects are there and I can see it is an NSCFArray.  Once the app loads, I click a table cell and in didSelectRowAtIndexPath:, that same array has a type of NSArray, no objects and I get a EXC_ BAD_ACCESS error.  If I precede the array with self in the app delegate, all is fine.  Why is that?</p>
  
  <p>Below is the app delegate .h file:</p>
  
  <pre><code>@interface MyAppDelegate : NSObject &lt;UIApplicationDelegate&gt; {
  
    UIWindow *window;
    UINavigationController *navigationController;
    NSMutableDictionary *aDict;
    NSArray *aArray;
  }
  
  @property (nonatomic, retain) IBOutlet UIWindow *window;
  @property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
  @property (nonatomic, retain) NSArray *aArray;
  @property (nonatomic, retain) NSArray *aDict
  @end
  </code></pre>
  
  <p>The array and dictionary are synthesized in the .m file.  I initialize the array in the app delegate .m file like this:</p>
  
  <pre><code>aArray = [self.aDict allKeys];
  </code></pre>
  
  <p>It is accessed like this in both root controller methods:</p>
  
  <pre><code>theDelegate = [[UIApplication sharedApplication] delegate]; 
  [theDelegate.aArray objectAtIndex:2];
  </code></pre>
  
  <p>Only when I reach didSelectRowAtIndexPath: does it fail.  Doing this in the app delegate makes everything work:</p>
  
  <pre><code>self.aArray = [self.aDict allKeys];
  </code></pre>
  
  <p>I didn't do anything to myArray between cellForRowAtIndexPath: and didSelectRowAtIndexPath:. Why does it fail in the first scenario?</p>