开发者

the physical path for my files inside the Resources folder of XCode (for IOS)

开发者 https://www.devze.com 2023-03-09 17:04 出处:网络
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:

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:

 NS开发者_高级运维String* 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!


I guess you are looking for NSBundle and pathForResource:ofType: method, aren't you?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号