I've got a class, called Letter. In the init method of Letter I am trying to load an Array of strings, so they can be used by other methods of that class.
I'm then instantiating an object based on the Letter class. I am expecting the init call to load the array, but instead am getting a EXC_BAD_ACCESS error.
Letter.h
@interface Letter : NSObject
{
NSArray *consonants;
}
-(BOOL)typeOfLetter:(NSString *)_letter;
Letter.m
#import "Letter.h"
@implementation Letter
- (id)init {
self = [super init];
if (self) {
consonants = [NSArray arrayWithObjects:@"B",@"C",@"D",@"F",@"G",@"Ğ",@"H",@"J",@"K",@"L",@"M",@"N",@"P",@"R",@"S",@"Ş",@"T","@U",@"V",@"Y",@"Z",@"b",@"c",@"d",@"f",@"g",@"ğ",@"h",@"j",@"k",@"l",@"m",@"n",@"p",@"r",@"s",@"ş",@"t",@"u",@"v",@"z",nil];
}
return self;
}
ViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
BOOL retValue;
Letter *letter = [[Letter alloc] init];
retValue = [letter typeOfLetter:@"a"];
}
What am I doing incorrectly here?