1

Here is the code that is successfully loading the HTML into UIWebView:

- (void)viewDidLoad {
    [super viewDidLoad];
    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Player" ofType:@"html"];  
    NSData *htmlData = [NSData dataWithContentsOfFile:filePath];  
    if (htmlData) {  
        NSBundle *bundle = [NSBundle mainBundle]; 
        NSString *path = [bundle bundlePath];
        NSString *fullPath = [NSBundle pathForResource:@"Player" ofType:@"html" inDirectory:path];
        [webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:fullPath]]];
    }
}

Here is the top part of Player.html, the HTML file is being loaded and shown, just with zero styling or javascript action:

<head><title>
    Course: Pegasus 1 of each
</title><link href="Content/css/jqueryui.css" type="text/css" media="screen" rel="Stylesheet" /><link href="Content/css/Templates.css" type="text/css" media="screen" rel="Stylesheet" /><link href="Scripts/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" rel="Stylesheet" /><link href="Content/css/Pegasus.css" type="text/css" media="screen" rel="Stylesheet" />

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js" type="text/javascript"></script>
    <script src="https://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js" type="text/javascript"></script>

    <script src="Scripts/browser.js" type="text/javascript"></script>
    <script type="text/javascript" charset="utf-8" src="Scripts/jstree/jquery.tree.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js" type="text/javascript"></script>

    <script type="text/javascript" src="Scripts/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
    <script type="text/javascript" src="Scripts/fancybox/jquery.easing-1.3.pack.js"></script>
    <script type="text/javascript" src="Scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
    <script type="text/javascript" src="Scripts/jquery.carouFredSel-2.5.5-packed.js"></script>
    <script type="text/javascript" src="Scripts/jquery.qtip-1.0.min.js"></script>
    <script type="text/javascript" src="Scripts/jquery.multifilterie.js"></script>
    <script type="text/javascript" src="Scripts/pegasus.js"></script>
    <script type="text/javascript" src="Scripts/jwplayer/jwplayer.js"></script>
    <script src="Scripts/jquery.form.js" type="text/javascript"></script>
    <script src="Scripts/raphael-min.js" type="text/javascript"></script>
    <script type="text/javascript" src="Scripts/pegasus.quiz.js"></script>

Here is the Group structure, notice that the paths are relative to the root location of Player.html:

enter image description here

But this is what I am getting:

enter image description here

What should I do to make it find the files?

1 Answer 1

2

The group structure you see in Xcode is not a folder structure. It's a way to organize your project workspace.
During the Copy Bundle Resources build phase, the files are copied to the root of your app bundle.

Check your resource dir in ~/Library/Apllication Support/IPhone Simulator/4.x.x/Applications/uid here/your.app. You will see that there is no Scripts folder.

Something like

<script src="./browser.js" type="text/javascript"></script>

should work.


If you really need to have a folder structure in your app bundle, select "Create Folder References for any added folders" when you add the Scripts and Content folders to your project resources.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.