I have the following code. word.txt is in “Supporting Files”:
NSString *filePath = [[NSBundle mainBundle] resourcePath];
filePath = [filePath stringByAppendingPathComponent:@"words.txt"];
NSData *data = [NSData dataWithContentsOfFile:filePath];
When I run using the simulator, data is not read properly but if I use the actual device, it works fine.
What is the problem?
This is how I do it and it seems to work for me:
And to set it to a string: