tags:

views:

158

answers:

2

I am geting an exception while hitting the line "self.myData = ..."

GDB Program received signal: EXC_BAD_ACCESS

Here's my code:

- (void)viewDidLoad {
    [super viewDidLoad];    
    self.myData = [NSArray arrayWithObjects:
          [NSArray arrayWithObjects: 
        @"Boroughs", 
        [NSArray arrayWithObjects: 
         @"Kings", 
         @"Bronx", 
         @"Manhattan", 
         @"Queens", 
         @"Staten Island", 
         nil], 
        nil],
          [NSArray arrayWithObjects: 
        @"Surrounding Counties", 
        [NSArray arrayWithObjects: 
         @"Westchester", 
         @"Nassau", 
         @"Suffolk", 
         "@Fairfield", 
         nil], 
        nil],
          nil];
}
+4  A: 

I'd say your problem is with the string "@Fairfield", unless that is a typo here and correct in your source file.

Amagrammer
Oh goodness - It's not a typo - copied it straight from source. Thanks!
Jeff Meatball Yang
not to mention Fairfield County is in Connecticut and all the other counties are in New York. </nitpick> :P
asveikau
A: 

If you want those arrays to continue to exist after -viewDidLoad, then they have to be retained. Did you synthesize an accessor for "myData"? Let's see the @property and @synthesize lines.

NSResponder