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 8173241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:04:28+00:00 2026-06-06T22:04:28+00:00

Currently I am using HTML files for parts of my user interface. I display

  • 0

Currently I am using HTML files for parts of my user interface. I display these files via WebView. This works as expected in debug mode in Xcode. Unfortunately, after having archived the app, the HTML resources are not being shown anymore.

That’s strange for many reasons: I can see the files are definitely in the correct resources folder within the app, the WebView doesn’t disappear or hide, it simply shows a white background as if it hasn’t loaded anything.

This observation is true for all HTML files within my project. Even if I don’t use them for UI but in order to export some data within a shareable HTML file, it doesn’t work (in release mode).

I did research on this issue but didn’t find anything of interest. I’m running out of ideas now…

  • 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-06-06T22:04:29+00:00Added an answer on June 6, 2026 at 10:04 pm

    Since you didn’t give your code in the question, it’s very hard to debug it… But from your own answer, I’m pretty sure I know the problem. You’re treating path strings and URL strings as interchangeable, and they’re not.

    You suggest this:

    [[inspectorView mainFrame] 
      loadRequest:[NSURLRequest 
            requestWithURL:[NSURL 
                    URLWithString:
                       [[NSBundle mainBundle]
                     pathForResource:@"inspectorView" 
                          ofType:@"html"
                         inDirectory:@"HTML/inspectorView"]]]];
    

    (I added some newlines to make it readable.)

    To call +[NSURL URLWithString:], you need a string representing a URL, not a string representing a path. But -[NSBundle pathForResource:ofType:inDirectory:] returns a path. There is a function to construct a URL from a path, +[NSURL fileURLWithPath:isDirectory:], if that’s what you want.

    But, unless you need to support 10.5 and earlier, it’s much easier to just get a URL in the first place and not bother converting back and forth, by using -[NSBundle URLForResource:withExtension:subdirectory:] instead of -[NSBundle pathForResource:ofType:inDirectory:].

    So:

    [[inspectorView mainFrame] 
      loadRequest:[NSURLRequest 
            requestWithURL:[[NSBundle mainBundle]
                     URLForResource:@"inspectorView" 
                      withExtension:@"html"
                       subdirectory:@"HTML/inspectorView"]]];
    

    In case you’re wondering why your code works in some cases but not others, consider what “/Applications/MyApp.app/Contents/” (I’m leaving off the “Resources/HTML/inspectorView/inspectorView.html” for brevity, because that’s not relevant here) means when read as a URL. It’s a relative URL; to interpret it, you take the current base, knock off the path portion, and replace it with the string. +[NSURL URLWithString:] happens to use “file://localhost” as the base, which means you end up with:

    file://localhost/Applications/MyApp.app/Contents/
    

    That happens to be a valid URL, and in fact the valid URL for exactly the file you wanted. That’s not documented to work, but it happens to. In this case. But what if you put a space in it? Then you get:

    file://localhost/Applications/MyApp X.app/Contents/
    

    That’s not a valid URL; what you want is this:

    file://localhost/Applications/MyApp%20X.app/Contents/
    

    And of course that’s exactly what you get if you call +[fileURLWithPath:isDirectory:] instead of +[URLWithString:].

    (I’m cheating a bit here. Actually, NSURL internally keeps track of the relative URL and the base separately, and composes them when you try to access the URL. But you can ignore that for now.)

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

Sidebar

Related Questions

I am currently matching HTML using this code: preg_match('/<\/?([a-z]+)[^>]*>|&#?[a-zA-Z0-9]+;/u', $html, $match, PREG_OFFSET_CAPTURE, $position) It
I am currently using this DOCTYPE: <!DOCTYPE HTML SYSTEM> However, when I validate my
I'm currently using TinyMCE as html editor for users of my CMS. Somehow the
I am currently using Jsoup to parse a html. The code is quite simple:
My site is currently using: <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd> However,
I want to pass the parameter which is rentalPeriod using Html.BeginForm. Currently, I put
I want to create a non-stop spinning square using html and css. I currently
I'm currently downloading an HTML page, using the following code: Try Dim req As
I'm currently using PHP to include multiple css (or js) files into a single
I am currently using CURL via a php script running as daily cron to

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.