iOS bundle sub folder directories

1.4k Views Asked by At

I have an Bundle folder, which consist of one .XML file and one folder. Which look like thisBundle Folder Structure

Here i have read the .XML file using NSXml Parser. The XML will look like,

<?xml version="1.0" standalone="yes"?>
<user id="32" name="lima"><class id="1" name="Third">  
<pages id="2" name="Page002.html" url="matematica/Page002.html"/>
</user>

I have read the URL value also, but how i have to give the URL value in the XML file, the Page002.html is inside the matematica folder. How i have to give that path in XML.? I'm loading that .HTML file in UIWebview. If i give like matematica/Page002.html webview can't find the path.

2

There are 2 best solutions below

4
V-Xtreme On

The folder Structure of in the Xcode is just logical grouping its nothing to do with the url . so off course your url is wrong in above case . You have give the full path of inside the url . You can get it by using :

  NSString *path=[[NSBundle mainBundle] pathForResource:@"Page002" ofType:@"html"];

then you can load it by :

[WebView loadRequest:[NSURLRequest requestWithURL:[NSUrl urlWithString:path]]]
0
iAppDeveloper On

try this

NSString *path=[[NSBundle mainBundle] pathForResource:@"Page002" ofType:@"html" inDirectory:@"matematica"];