开发者

pathForResources returning (null)

I am using these lines of code

N开发者_开发知识库SString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:@"test"];
 NSLog(@"%@", path);

And the NSLog is printing out (null).

The file I'm trying to read is index.html. It is in the test folder which is in my project folder. Does anyone know why path returns (null).

Thanks

Clinton


This method will return nil if your resource can't be found. Try another one like -(NSString *)pathForResource:(NSString *)name ofType:(NSString *)extension inDirectory:(NSString *)subpath specifying 'test' as the directory name.

Also make sure your file is included into your app bundle...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜