Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7618141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:19:25+00:00 2026-05-31T03:19:25+00:00

I have a .html file that needs to go into my iPhone app’s bundle

  • 0

I have a .html file that needs to go into my iPhone app’s bundle resource directory. I tried FIle -> New -> Resource but nothing seemed to fit the bill.

Right now I’m using a UIWebView loadRequest and have the “pathForResource:@”help.htm”… it crashes when it can’t find help.htm. If I put this in a Resource directoyr, I believe I can still use the same code without any directory qualifiers.

How do I do this?

UPDATE:

Here is the UIWebView code:

- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    if([[segue identifier] isEqualToString:@"helpSegue"])  {

        [slWebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"iHelp.htm" ofType:@"html"]isDirectory:NO]]];


    }
    else 
        if ([[segue identifier] isEqualToString:@"reportSegue"]) {
            NSLog(@"reportSegue");
        }
}

Here is the error I’m getting:

 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:isDirectory:]: nil string parameter'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T03:19:26+00:00Added an answer on May 31, 2026 at 3:19 am

    I think this is your problem:

    [slWebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"iHelp.htm" ofType:@"html"]isDirectory:NO]]];
    

    You need to omit the extension from the file name since it is specified in a separate parameter:

    [slWebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"iHelp" ofType:@"htm"]isDirectory:NO]]];
    

    Then just add the “iHelp.htm” file to the project as normal making sure it is marked as included the applications target.

    Just to be sure, try right clicking your app in the “Products” group and select “Reveal in Finder”. Then right click the .app bundle (which is just a folder) and select reveal contents to see what’s actually included. If you don’t see your “iHelp.htm” file it means it is not marked as a member of the target. Find and select the “iHelp.htm” file in Xcode then open the utilities view. Look under the “Target Membership section and make sure the checkbox for your application target is checked.

    Update
    What you see with the above change is this:

    [[NSBundle mainBundle] pathForResource:@"iHelp" ofType:@"htm"]
    

    Causes a search in the app bundle for “iHelp.htm” which is returning the path of the htm file where before it was returning nil since it couldn’t find it. (Before you were looking for “iHelp.htm.html” which didn’t exist. The next part of your problem is figuring out why this path is not properly converted to a URLRequest. You have a lot of inlining, which I personally love, but to correctly debug you may want to break it out into separate variables temporarily.

    NSString *iHelpPath = [[NSBundle mainBundle] pathForResource:@"iHelp" ofType:@"htm"];
    NSLog(@"iHelpPath = %@", iHelpPath);
    NSURL *fileURL = [NSURL fileURLWithPath:iHelpPath];
    NSLog(@"fileURL = %@", fileURL);
    NSURLRequest *request = [NSURLRequest requestWithURL:fileURL];
    NSLog(@"request = %@", request);
    

    And see what that gives you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to DOM parsing in PHP: I have a HTML file that I'm
I have an HTML (App) file that reads another HTML (data) file via jQuery.ajax()
I have a HTML file that has code similar to the following. <table> <tr>
I have a html file that has invoice details I would like to know
I have a html file that contains urls that start with ftps, http, https,
I have a html file that I want to trim. I want to remove
I have long recognized that any set of whitespace in an HTML file will
First I have a PHP file that gets data and file from a HTML
I have an upload script that write a index.html file, I modified it to
Absolute beginner question: I have a template file index.html that looks like this: ...

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.