Path to a file inside application package?

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

  1. jsnuff1 macrumors 6502a

    Joined:
    Oct 4, 2003
    Location:
    NY
    #1
    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

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

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

Share This Page