问题
I'm developing an application for iPad. I want to access a text file inside the Resources folder! I'm doing that in following way:
NSString* filePath = @"/Users/net4uonline/Desktop/slots2/paylines.txt";
Now, if I move my whole project from Desktop to somewhere else I know this won't work. So, is there any way to give a relative path for this file instead of the current path. Maybe like the following?
NSString* filePath = @"Resources/paylines.txt";
I know this won't work but as my file is always going to reside inside the Resources folder, so I thought this might work!
回答1:
I guess you are looking for NSBundle and pathForResource:ofType: method, aren't you?
来源:https://stackoverflow.com/questions/6172165/the-physical-path-for-my-files-inside-the-resources-folder-of-xcode-for-ios