Whats wrong with my code.. I want it to read a text file like
Item1
Item2
Item3
Item4
Item5
and parse it into an array so each line is a separate object in thus array.
When you check the console it prints (null)
-(void)parseIntoArray{ //parse the files into seprate arrays.
allPools = [[NSMutableArray alloc] initWithContentsOfFile:@"ALL_POOLS_NAMES"];
NSLog(@"%@",allPools);
}
I put the txt file in my project and copied it to destination.
Firstly, can you verify that the file exists where you are looking and is readable?
Use
Secondly, what is in your file. The behaviour of initWithContentsOfFile:
Is your file a valid plist xml file?
InResponse
You cannot use the NSArray constructor initWithContentsOfFile: to parse a regular text file.
Instead you can read the file content into memory and parse it yourself into an array. For your example you could use