Reputation: 36643
I'm trying to access a file in my resources folder as follows:
NSLog(@"%@",defaultPlistName);
NSString *pListPath = [[NSBundle mainBundle] pathForResource:defaultPlistName ofType:@"plist"];
NSLog(@"pListPath: %@ ",pListPath);
This is the output:
2015-03-13 10:08:43.078 MyApp[628:214709] DefaultConfig
2015-03-13 10:09:26.560 MyApp[628:214709] pListPath: (null)
A file named "DefaultConfig.plist" exists in the resource folder.
Why isn't this file being found?
Upvotes: 0
Views: 159
Reputation: 4946
Check the Copy Bundle Resources for your target to make sure the file has been added properly.
Usually, when when adding a new file, you can choose the targets when creating the file. Also, for each file you can add/remove the file from targets via the Utilities Pane.
Upvotes: 1
Reputation: 36643
It turns out that I had to add "DefaultConfig.plist" to "Build Phases", "Copy Bundle Resources".
Upvotes: 1