使用子文件夹不适用于pathForResource和URLforResource

Nas*_*aer 0 filesystems iphone directory xcode ipad

我看了一些项目,很高兴找到如何 增加真正的子文件夹 ,但没有任何解决方案让我看到在我的子文件夹中的文件.一切都回来了.

XCode的路径问题

inDirectory

我已经尝试过pathForResource和URLforResource以及inDirectory方法.

        //NSString *W = [[NSBundle mainBundle] pathForResource:@"LS_ADINFO_0000_LFSB" ofType:@"xml" inDirectory:@"/2012-03-08%20(Published%20as%2008%20MAR%202012)/AERODROMES/LFSB/"];
        //urlPDF = [NSURL URLWithString:W];
        // DEBUG output: urlPDF = nil

        //urlPDF = [[NSBundle mainBundle] URLForResource:@"LFSB/LS_ADINFO_0000_LFSB.xml" withExtension:nil]; 
        // DEBUG output: urlPDF = nil


        //urlPDF = [[NSBundle mainBundle] URLForResource:@"LS_ADINFO_0000_LFSB.xml" withExtension:nil]; 
        // DEBUG output: urlPDF = file://localhost/Users/siri/Library/Application%20Support/iPhone%20Simulator/5.0/Applications/1F5953CD-1E13-40D4-9497-8313F9DDEA77/SwissVfrm03.app/LS_ADINFO_0000_LFSB.xml
Run Code Online (Sandbox Code Playgroud)

如何在XCode中设置子目录以便在iPad App中访问?

小智 6

在iOS应用程序中,非本地化资源位于bundle目录的顶层.您可以按路径创建自定义捆绑包,但默认情况下,无论您在Xcode中设置了哪些目录,所有资源都位于捆绑包的顶层.

iOS捆绑编程指南