相关疑难解决方法(0)

使用[NSBundle mainBundle] pathForResource:ofType:inDirectory访问文件:

paylines.txt在名为的文件夹中添加了一个文件,该文件TextFiles位于ResourcesXcode中我的iOS项目的文件夹中.

这是我用来访问文件的代码:

NSString* filePath = [[NSBundle mainBundle] pathForResource:@"paylines" ofType:@"txt" inDirectory:@"TextFiles"];
NSLog(@"\n\nthe string %@",filePath);
Run Code Online (Sandbox Code Playgroud)

代码打印:

2011-06-07 14:47:16.251 slots2[708:207] 

the string  (null)
Run Code Online (Sandbox Code Playgroud)

xcode objective-c filepath nsbundle ios

42
推荐指数
4
解决办法
10万
查看次数

标签 统计

filepath ×1

ios ×1

nsbundle ×1

objective-c ×1

xcode ×1