Path to a file inside application package?

Discussion in 'iOS Programming' started by jsnuff1, Sep 16, 2008.

  1. jsnuff1 macrumors 6502a

    Oct 4, 2003
    How would you go about programatically obtaining the file URL of a file thats in the root directory of the application package?

    My app reads an XML file that I have included with it, but have no idea on how to access it.
  2. SqueegyX macrumors regular

    Mar 24, 2008
    Here is a snippet from an app of mine:

    NSString *template = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"post" ofType:@"html"]];
    This will load the files named "post.html" into an NSString.

Share This Page