我们能知道Xode项目中NSBundle的内容吗?
如何知道XCode Porject中NSbundle的内容?
bcoz 问题是,我在 XCode 项目的资源文件夹中放置了一个 config.doc 文件,并且我想读取该 config.doc 文件的内容,但它说找不到 config.doc 文件。如何解决这个问题?
这就是我的代码的样子:
-(void)applicationDidFinishLaunching:(UIApplication*)application
{
if([NSBundle mainBundle]pathForResource;@"config" ofType:@"doc")!=nil)
{
NSLog(@"File Exists");
}
else
{
NSLog(@"File not found!!");
}
NSString *configContents = [[NSBundle mainBundle]pathForResource:@"config" ofType:@"doc"];
NSLog(@"Contents of config file : %@",configContents);
}
输出:
File not found!!
Contents of config file :(null)
如何解决这个问题?我无法弄清楚错误在哪里.. 请帮忙
谢谢
How to know the contents of NSbundle in XCode Porject??
bcoz issue is, I have placed a config.doc file in resource folder of my XCode project and i want to read the contents of that config.doc file, but it says that config.doc file is not found. How to solve this problem??
This is how my code looks like:
-(void)applicationDidFinishLaunching:(UIApplication*)application
{
if([NSBundle mainBundle]pathForResource;@"config" ofType:@"doc")!=nil)
{
NSLog(@"File Exists");
}
else
{
NSLog(@"File not found!!");
}
NSString *configContents = [[NSBundle mainBundle]pathForResource:@"config" ofType:@"doc"];
NSLog(@"Contents of config file : %@",configContents);
}
OUTPUT :
File not found!!
Contents of config file :(null)
how to solve this problem?? i'm not able to make where is the mistake..
plz help
Thank You
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过以下方式查看捆绑包的内容:
现在您可以可以检查文件是否确实存在于包中。
You can see the contents of the bundle in the following way :
Now you can check whether the file actually exists in the bundle or not.