Reputation: 398
Hello!
I try to extract the values from an array (prepTime), but it don't show them. When I compile the program I get an error:
0xec80b0: cmpl (%eax), %ecx Thread 1: EXC_BAD_ACCESS (code=1, address=0xff31e10)
Here I created the array:
{
NSArray *tableData;
NSArray *thumbnails;
NSArray *prepTime; //Here I created the array
}
Here I filled it with values:
- (void)viewDidLoad
{
[super viewDidLoad];
// Initialize table data
tableData = [NSArray arrayWithObjects:@"Egg Benedict", ... @"Angry Birds Cake", @"Ham and Cheese Panini", nil];
// Initialize thumbnails
thumbnails = [NSArray arrayWithObjects:@"egg_benedict.jpg", ... @"angry_birds_cake.jpg", @"ham_and_cheese_panini.jpg", nil];
//Initialize prep time
prepTime=[NSArray arrayWithObjects: @"90 min", "60 min", "45 min", ... "10 min", "60 min", "40 min", nil];
}
As you can see there are three arrays in my code were defined and filled with values, but only 'prepTime' array don't show it values in my table cell and give an error when compile it instead.
Why it happens?
Thanks a lot!
Upvotes: 1
Views: 83
Reputation: 727067
It looks like you have missed a few @
signs in some of your string literals:
prepTime=[NSArray arrayWithObjects: @"90 min", "60 min", "45 min", ... "10 min", "60 min", "40 min", nil];
// ^Here ^Here ^Here ^Here ^Here
Trying to access the resultant C strings as NSString
causes bad access.
Upvotes: 4