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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:38:04+00:00 2026-05-23T16:38:04+00:00

I have a hybrid (Objective C + HTML) application and I would like to

  • 0

I have a hybrid (Objective C + HTML) application and I would like to be able to periodically save a remote file (images and css) to a user’s device but in such a way that it can be loaded by a browser within a webview instance in the same application.

I don’t think it’s possible to save files to the resource bundle itself (though in the simulator you can), so I assume I would have to save the file somewhere else. But I’m not sure what path to use where the HTML document could still access it.

Basically, I’d like to do something like this:

    NSURL* url = [NSURL URLWithString:@"http://myserver.com/August.png"];
    NSString* filePath = @"[?????]/MonthlyImage.png";
    NSData* data = [NSData dataWithContentsOfURL:url];
    if (data)
    {
        NSError* error;
        if ([data writeToFile:filePath options:NSDataWritingAtomic error:&error])
        {
            NSLog(@"Wrote");
        }
        if (error != nil) 
        {
            NSLog(@"ERROR: %@", [error description]);
        }
    }

Then in my webview, I’d like to be able to load the image like this:

<img src="[??????]/MonthlyImage.png" />

What values can I use in place of the ?????? that will work? Is it even possible?

  • 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-23T16:38:04+00:00Added an answer on May 23, 2026 at 4:38 pm

    Saving to the bundle is not allowed because it is not allowed to modify the app binary.

    You could try and store the file in the documents folder, then retrieve it from there. The important point, to make it work, is specifying also a baseURL when creating the UIWebVIew.

    You can retrieve the documents directory in this way:

    NSString *documentsDirectory = nil;
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
                                                         NSUserDomainMask, YES);
    if ([paths count] > 0) {
        documentsDirectory = [paths objectAtIndex:0];
    }
    

    Then you store there your file, and when you want to load it in your UIWebView, execute:

        [_label loadHTMLString:htmlString baseURL:[NSURL fileURLWithPath:documentsDirectory]];
    

    Now, <img src="MonthlyImage.png" /> will look for the png in your documents directory.

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

Sidebar

Related Questions

Which would be the most recommended python hybrid to create GUI application? I have
I have an Android/HTML hybrid application that has a small number of nested ViewFlippers
I have a hybrid ASP.NET MVC application, and I'd like to test that the
i have create a form (so it's PHP and HTML hybrid-code). it has ability
We have an x-files problem with our .NET application. Or, rather, hybrid Win32 and
HEllo, I have a hybrid iPhone application that has a UITabBarController and 5 Tabs.
I have a large application that currently exists as a hybrid of WebForms and
I have a rails application that serves as an interface to a hybrid of
I have a hybrid Struts 1 and Struts 2 application. My Struts 1 application
I need to track/modify QtWebkit HTTP requests. I have a hybrid web/desktop application prototype

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.