开发者

Beginner: Why do I get a EXC BAD ACCESS? [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making 开发者_StackOverflow中文版this question more broadly applicable, visit the help center. Closed 9 years ago.

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];
}


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜