Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c iOS mainBundle未加载资源_Objective C_Ios - Fatal编程技术网

Objective c iOS mainBundle未加载资源

Objective c iOS mainBundle未加载资源,objective-c,ios,Objective C,Ios,我有一个正在工作的iOS项目,在git分支上工作时,该项目突然无法从主捆绑包加载任何资源…我正在加载一个简单AVAudioPlayer的音频文件,其中包含: NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/nadamintrov1.aif", [[NSBundle mainBundle] resourcePath]]]; NSError *error; NSLog(@"%@", url); splashScr

我有一个正在工作的iOS项目,在git分支上工作时,该项目突然无法从主捆绑包加载任何资源…我正在加载一个简单AVAudioPlayer的音频文件,其中包含:

NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/nadamintrov1.aif", [[NSBundle mainBundle] resourcePath]]];
NSError *error;
NSLog(@"%@", url);
splashScreenAudioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
在其他ViewController中,我还加载其他文件,例如:

    patch = [PdBase openFile:@"klangfarbe6ep.pd" path:[[NSBundle mainBundle] resourcePath]];
if (!patch) {
    NSLog(@"Failed to open patch!");
    // Gracefully handle failure...
}
但是,虽然这两个功能以前都工作得很好,但现在我得到了“无法初始化splash audio player”和补丁:

open: /var/mobile/Applications/464B65AD-9E2C-42C9-8BBA-12AFD0D48393/Nadam.app/klangfarbe6ep.pd: No such file or directory
klangfarbe6ep.pd:没有这样的文件或目录 2012-02-26 12:07:17.332 Nadam[520:707]无法打开修补程序

这很奇怪…我指的是NSLog(@“%@”,url);我为AudioPlayer提供了清晰的返回:

2012-02-26 12:06:49.127 Nadam[520:707] file://localhost/var/mobile/Applications/464B65AD-9E2C-42C9-8BBA-12AFD0D48393/Nadam.app/nadamintrov1.aif
那它到底为什么不装呢?在过去的几次更改中,git的差异并没有在项目文件中显示任何我认为是损坏的内容

以前有人在他们身上发生过这种事吗?有什么办法调试它吗?我读了这篇文章:


但是我不明白为什么它以前可以工作,而现在却没有项目变更…

我不知道这里到底是什么问题。但这是最常见的问题。在两种情况下会出现这种问题。1.文件路径错误。2.文件未包含在捆绑包中。

在检查了您显示的上述文件路径后,我认为这不是文件路径的问题。但您可以检查您的文件是否包含在目标中。只需右键单击文件并选择“获取信息”。是否选择了签入目标当前目标。

结果表明,正是它,只是一个未复制到捆绑包中的资源。我看了看目标,然后总体上看了构建目标,瞧,它们没有被复制。修复它们修复了它。