Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Load xml file in a sub directory #27

@ngojchieern

Description

@ngojchieern

In the method initWithXMLFile, in order to load the file the following code is used:
NSString * bundlePath = [[NSBundle bundleForClass:[self class]] pathForResource:aXMLFile ofType:aFileExtension];
I think this is not good. Because when aXMLFile is a file path with directory it won't load correctly. The best way to handle it is to use pathForResource in directory:
NSString *directory = [aXMLFile stringByDeletingLastPathComponent];
NSString *file = [aXMLFile lastPathComponent];

    NSString * bundlePath = [[NSBundle bundleForClass:[self class]] pathForResource:file ofType:aFileExtension inDirectory:directory];

Hope you can fix it in the next version :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions