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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:12:08+00:00 2026-06-09T15:12:08+00:00

I’m currently working on a mobile app using Phonegap 1.4.1. On iOS (currently using

  • 0

I’m currently working on a mobile app using Phonegap 1.4.1. On iOS (currently using 5.1) the app won’t load all the data from localStorage.

The first time the app is used I set a flag in localStorage like so:

window.localStorage.setItem("myFlag", "true");

I also set items “ItemA”, “ItemB”, and “ItemC” in the same way. Each of these key/value pairs are set at different times during the use of the app, so there’s no defined order in which they are set.

My problem is this:

When I reinstall the app, without deleting the existing copy first, the app no longer sees “MyFlag”, “ItemB” or “ItemC” – it does see “ItemA”. Using window.localStorage.length returns 1, when it should return 4. I have exported the app’s data files and examined the file__0.localstorage file with SQLite Inspector (app from the app store) and it shows all four key/value pairs.

Since iOS 5.1+ has moved the localstorage to the Cache folder I have implemented the backing up of the file__0.localstorage file as described here. Basically, what that does is copy the localstorage db to the Documents folder on app pause and exit, and back to the Cache folder on execution of webViewDidStartLoad. This part is working fine, so I don’t think that procedure is causing the problem (the symptom of the problem existed in the app before I added that procedure).

  • 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-09T15:12:09+00:00Added an answer on June 9, 2026 at 3:12 pm

    This turned out to be a result of the Cordova (Phonegap) bug reported here. So it was a combination of Apple moving the location of the file__0.localstorage file to the Cache directory and an Apple bug where the Bundle ID for apps is changed when upgrading to a new version of an app and a couple of .plist file entries weren’t updated to reflect the new Bundle ID.

    The proposed fix, posted as an attachment here didn’t quite work out-of-the-box, as the files included referenced CDVInvokedUrlCommand which referenced JSONKit. So downloading the latest CDVInvokedUrlCommand.h and CDVInvokedUrlCommand.m as well as JSONKit.h and JSONKit.m (all from the Cordova GitHub repo) was also necessary. The code in the README.txt file of the Phongap 1.4.1 version of the proposed fix also included an error. It said:

    6) In your app’s “AppDelegate.m”, replace your “webViewDidStartLoad” function with this:

        - (void) webViewDidStartLoad:(UIWebView *)theWebView 
        {
            static CDVLocalStorage* localStorage = nil;
            if (localStorage == nil) {
                localStorage = [[CDVLocalStorage alloc] initWithWebView:theWebView];   
                [localStorage restore:nil withDict:nil];
            }
    
            return [ super webViewDidStartLoad:theWebView ];
        }
    

    But it should have said to add the body of the above method to the method you already have with this signature – and the line [localStorage restore:nil withDict:nil]; should be changed to [localStorage restore:nil];, as the former method signature doesn’t exist anywhere.

    Of course, the proper imports also had to be added to AppDelegate.m.


    Upgrading to the latest version of Phonegap would be the simplest solution for those who are able to do so. However, we are using the (relatively suddenly) ancient version 1.4.1 and a 3rd party plugin which isn’t compatible with newer versions of Phonegap yet – so this fix was the best fit for us.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a text area in my form which accepts all possible characters from
I am currently running into a problem where an element is coming back from
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the

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.