I have a textfile which consists of multiple words. They are all separated by new lines.
What Ive tried:
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"file" ofType:@"txt"];
if (filePath) { // This does trigger, so the file is actually found.
NSArray *arr = [filePath componentsSeparatedByString:@"\n"];
}
What Ive also tried:
NSMutableArray * lines = [[NSMutableArray alloc] initWithArray:[filePath componentsSeparatedByString:@"\n"] copyItems: YES];
Neither of these seems to work as I only seem to get the filepath when I read out lines using NSLog. Can any of you help?
The lines array only seem to consist of one object, the string of the location of the textfile.
I want an array where each string is a string separated by a line in the textile.