I've been trying to load a simple text file in a unit test for an iOS app.
NSString* resourcePath = [[NSBundle mainBundle] pathForResource: @"stopPointsInCircleData" ofType:@"txt"];
NSString* stopPointData = [NSData dataWithContentsOfFile: resourcePath];
My problem is that pathForResource returns nil.
The file stopPointsInCircleData.txt is located in the directory of the test code and the file is listed correctly under "Copy Bundle Resources" in the "Build Phases" of the test target.
I've tried to relax the search by setting ofType to nil, but thet didn't work either.
Any help is very much apprechiated.
See Question&Answers more detail:os