If you use add file
add some files in your project. You can access them like this:
NSError *error;
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"hello" ofType:@"txt"]; // I add __hello.txt__ into my project.
NSString *filecontent = [NSString stringWithContentsOfFile:filepath encoding:NSUTF8StringEncoding error:&error];
NSLog(@" content: %@", filecontent);
And If you want read file line by line. You can do this:
// this array's length is the number of lines.
NSArray *fileContent = [[NSString stringWithContentsOfFile:filepath encoding:NSUTF8StringEncoding error:&error] componentsSeparatedByString:@"\n"];