I have the following class:
#import "SharedData.h"
static int selectedCountryIndex;
static NSMutableArray *imageDataObjectsArray;
@implementation SharedData
+(void)insertIntoImageDataObjectsArray:(ImageData *)imageData:(int)index{
if (!imageDataObjectsArray)
**imageDataObjectsArray = [[NSMutableArray alloc]init ];**
[imageDataObjectsArray insertObject:imageData atIndex:index];
}
+(ImageData *)getFromImageDataObjectsArray:(int)index{
return [imageDataObjectsArray objectAtIndex:index];
}
+(void)setSelectedCountryIndex:(int)selectedCountryIndexArg{
selectedCountryIndex = selectedCountryIndexArg;
}
+(int)getSelectedCountryIndex{
return selectedCountryIndex;
}
@end
This class is just meant to accept data from one view, and then allow another view to fetch that data. However, whenever the insertIntoImageDataObjectsArray method is called, the line marked with asterisks causes an "EXC_BAD_ACCESS" crash. This is the call to that method:
[SharedData insertIntoImageDataObjectsArray:imageDataObject :[result doubleValue]-1];
Anyone have any idea why?
get.