iPhone / NSArray : How do I format a text file to be read in using arrayWithContentsOfFile
- by nickthedude
I have several large word lists and I had been loading them in place in the code as follows:
NSArray *dict3 = [[NSArray alloc] initWithObjects:@"abled",@"about",@"above",@"absurd",@"absurdity", ...
but now it is actually causing an exc_bad_access error weirdly, i know it seems implausible but for some reason IT IS causing it. (trust me on this I just spend the better part of a day debugging this crap)
Anyway, I'm looking to get these humongous lines of code out of my files but I'm not sure what the best approach is. I guess I could do a plist but I need to figure out how to automate the process.
it be easiest if I could just use the text files I've been compiling so if anyone knows how I can format the text file so that the
myArray = [NSArray arrayWithContentsOfFile: @"myTextFile.txt"];
will be read in correctly as one word per element in the array it would really be appreciated.
Thanks,
Nick