Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue with NSMutableArray visibility / retain
    primarykey
    data
    text
    <p>Alright so I am a little new to the NSMutableArray class and I think I am missing something obvious. I have an object pass a NSMutable Array to my window controller like so in my.m:</p> <pre><code>summaryWindow = [[SummaryWindowController alloc] init]; [summaryWindow setGlobalStatusArray:globalStatusArray]; </code></pre> <p>I have the receiver method in the summaryWindow object as so:</p> <pre><code>-(void)setGlobalStatusArray:(NSMutableArray *)myArray { if ([myArray count] &gt;0) { if (globalStatusArray) { [globalStatusArray release]; } globalStatusArray = [[NSMutableArray alloc] initWithArray:myArray]; NSLog(@"Summary Window Init with new array: %@",globalStatusArray); </code></pre> <p>I see the NSLog no problem, and in that same object (summaryWindow) I have the following method:</p> <pre><code>- (NSMutableArray *)getGlobalStatusArray { return globalStatusArray; } </code></pre> <p>Now I have globalStatusArray declared in my .h file as</p> <pre><code>NSMutableArray *globalStatusArray; </code></pre> <p>So shouldn't This be retained because I am using: initWithArray?</p> <p>When I try to access this value in an another IBAction method:</p> <pre><code>- (IBAction)refreshButtonClicked:(id)sender { NSLog(@"The user has clicked the update button"); [ aBuffer addObjectsFromArray: globalStatusArray]; NSLog(@"Buffer is currently:%@",aBuffer); [tableView reloadData]; } </code></pre> <p>The NSMutable array is null</p> <pre><code>2011-08-18 10:40:35.599 App Name[65677:1307] The user has clicked the update button 2011-08-18 10:40:35.600 App Name[65677:1307] Buffer is currently:( ) </code></pre> <p>I have tried using my own method to get the value i.e. [ self getGlobalStatusArray] to but I am missing something huge. FYI aBuffer is also declared in my .h ,</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload