Question

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];
}
Was it helpful?

Solution

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

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top