pathForResource返回null [英] pathForResource returns null

查看:104
本文介绍了pathForResource返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的项目中加载一些.applescript文件。

I'm trying to load some .applescript files in my project.

将它们复制到支持文件目录中,如下所示:

Copied them into the "Supporting Files" directory like this:

>

并试图访问它们:

NSBundle *bundle = [NSBundle mainBundle];
NSLog(@"Resource path for test.applescript: %@", [bundle pathForResource:@"test" ofType:@"applescript"]);

pathForResource总是返回null。

pathForResource always returns null.

文件在xcode中正确导入。目标会员是我的应用程序。
类似问题的解决方案没有真正帮助

Both files are correctly imported in xcode. The target membership is my app. Solutions from similar questions didn't really help

我做错了什么?

推荐答案

在Xcode目标Build Phases中,添加Copy Bundle Resources下的文件。

In the Xcode target "Build Phases" add the file under "Copy Bundle Resources"".

这篇关于pathForResource返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆