function works in viewDidLoad but not CellForRowAtIndexPath--why?
<p>I have a (hopefully silly) iPhone programming question.  I'm trying to get a string out of an object I created, stored in an AppDelegates NSMutableArray--is there a reason I always get an EXC_BAD_ACCESS error when I try to access (via the appdelegates array, or my controllers copy of it) my NSMutableArray in the cellForRowAtIndexPath method, but NO PROBLEM whatsoever in my ViewDidLoad method?  Any thoughts appreciated!</p>

<p>In my "viewDidLoad" method, I have the following code:</p>

<pre><code>    appDelegate = (Social_Cost_TrackerAppDelegate *)[[UIApplication sharedApplication] delegate];
    [appDelegate setArray];
    myCompanies = appDelegate.companies;
    NSLog(@"Important Value: %i",[myCompanies count]);
    Company *c = [myCompanies objectAtIndex:0];
    NSString *me = [c cname];
    NSLog(@"2nd Val: %@", me);
</code></pre>

<p>In my "cellForRowAtIndexPath" I have the following code:</p>

<pre><code>    NSLog(@"Problem Spot--myCompanies-Size: %i",[myCompanies count]);
    Company *c = [myCompanies objectAtIndex:0];
    NSString *me = [c cname];
    NSLog(@"2nd Val: %@", me);
</code></pre>

<p>Yet, in the "cellForRowAtIndexPath" method, I get the following error:</p>

<blockquote>
  <p>Program received signal:  “EXC_BAD_ACCESS”.</p>
</blockquote>

<p>What am I doing wrong, why can I get a size out of my array, but not an object?  I'm a bit stumped here... Thanks for any thoughts!  (P.S. I'm not an iPhone/Objective-C developer--just doing a bit of learning here with a side-project).</p>

<p>Below is my debugger output:
2009-11-19 18:42:57.883 Social Cost Tracker[688:207] Important Value: 5
2009-11-19 18:42:57.883 Social Cost Tracker[688:207] 2nd Val: UCBrewers
2009-11-19 18:42:57.885 Social Cost Tracker[688:207] Problem Spot--myCompanies-Size: 5
Program received signal:  “EXC_BAD_ACCESS”.</p>
