Iphone 无法保存文件NSBundle.h

Iphone 无法保存文件NSBundle.h,iphone,objective-c,xcode,filesystems,bundle,Iphone,Objective C,Xcode,Filesystems,Bundle,我在使用捆绑包时遇到了一些问题,不知何故,我无法再将图像从捆绑包保存到docs目录。现在,我在构建之前遇到了以下错误: 无法创建文件NSBundle.h 拯救 它显然编译得很好。 这就是我正在使用的代码类型: //Get every name from plist array and append it to the full path for( NSString *aName in namesPackage ) { bundlePath = [[NSBundle mainBundle

我在使用捆绑包时遇到了一些问题,不知何故,我无法再将图像从捆绑包保存到docs目录。现在,我在构建之前遇到了以下错误:

无法创建文件NSBundle.h 拯救

它显然编译得很好。 这就是我正在使用的代码类型:

//Get every name from plist array and append it to the full path
for( NSString *aName in namesPackage ) {

    bundlePath = [[NSBundle mainBundle] pathForResource:aName ofType:@"png"];
    if([fileManager fileExistsAtPath:bundlePath])NSLog(@"it exists in bundle:  %@",bundlePath);
    imagePath = [NSString stringWithFormat:@"%@/%@/%@",DOCUMENTS_FOLDER,package,aName];

    [fileManager copyItemAtPath:bundlePath toPath:imagePath error:&anError];
    if(anError) NSLog([anError description]);
}   

提前感谢您的帮助。

您应该使用NSString的文件扩展名类别:

-stringByAppendingPathComponent:
-stringByAppendingPathExtension:
这将解决任何后续斜杠等潜在问题


此外,您应该永远不要将任何未知字符串作为格式参数传递给任何可变长度函数,因为它们可能包含格式说明符。改为使用NSLog(@“%@”,一个错误)。

没关系,我在NSBundle头文件中做了一些更改,Xcode试图保存它。您看到了什么样的运行时错误和/或NSLog输出?