facebook

Cache problem

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #319348 Reply

    SonamGyato
    Member

    When using the app sometimes i get this error message.

    Error: Unable to cache web page for offline use. Visit Safari settings to clear cache.

    Why does this happen.

    (in non-airplane mode)

    #319350

    SonamGyato
    Member

    ok i found the error message in phoneui.js

    webappCache.addEventListener(“error”, function(str) {
    phoneui.hideActivityDialog();
    if (wasDownloaded) {
    alert(“Error: Unable to cache web page for offline use. Visit Safari settings and clear cache.”);
    }
    }, false);

    maybe the “str” arg should be printed out for a better reason.

    also, on the updateReady event, don’t you need the following
    line before the reload()

    window.applicationCache.swapCache();

    webappCache.addEventListener(“updateready”, function() {
    location.reload(); // Reload page right after update came.
    }, false);

    #319368

    support-michael
    Keymaster

    @everest

    Investigating. I’ve asked the lead dev to look into this with me.

    #319405

    support-michael
    Keymaster

    @everest

    Update:
    I talked to the lead dev earlier today. I believe the handler should include the swapCache() call. But I’m still investigating to confirm this. The lead dev believes the swapCache() call can be omitted as the reload of the page effectively results in a cache update effect.

    Why does the error msg get presented?
    We think it might be that you are encountering the 5Mb cache size of mobile safari. The cache is per domain so it can easily fill up if you are loading several webapps from the same domain. Also the error message that is hardcoded was done so as an alternative to presenting cryptic low level technical msgs.

    How often do you encounter cache related errors?

    #319406

    SonamGyato
    Member

    it’s just 2 apps…and shouldn’t be anywhere near the 5 mb limit
    unless it also stores previous versions.

    it doesn’t happen often – and it’s difficult to replicate.

    i understand it can also happen if the manifest file is being
    uploaded when the app is being downloaded.

    re the swapcache, it seems to be unncessary because the browser
    runs the newest upload. i only threw it out there because i saw
    it in an online code snippet.

    i would suggest printing out the low level “str” parameter at least
    to the console so that it can be debugged.

    #319442

    SonamGyato
    Member

    after further investigation, i believe the
    swapcache call is necessary.

    all users installing the app for the first time, is getting
    the “error” event.

    clear safari cache and come back – and seems to
    work.

    all code samples on this topic seem to have the swapcache.

    also the “error” event doesn’t seem to get a valid
    “str” argument as coded in phonui.js. no arguments
    are passed.

    #319456

    SonamGyato
    Member

    with more users reporting – when the app is installed for the
    first time on a device – they’re getting

    “Error: Unable to cache web page for offline use. Visit Safari settings and clear cache.”

    my app is no where close the to the limit.

    but once they clear cache and re-download it seems to be ok.

    pls respond.

    #319470

    support-michael
    Keymaster

    @everest

    I can definitely see how this can be annoying. Can you send me a link to test this out?
    If you want to keep it private send the link to me at
    support at genuitec dot com with title “URL for wayne from everst”

    #319473

    support-michael
    Keymaster

    @everest

    Follow re: swapCache() behavior and usage. I have talked to the lead dev on many occasions about app cache and quirks. Here is what I have learned:

    0) swapCache() is only useful for trivial appcache examples
    – or in rare cases where there may be an extremely large cache (100Mb) that can take some time to swap in

    1) swapCache() does not reload resources for the current page. Thus if you call swapCache() and your current page is impacted by the new cached contents then the page must be reloaded to pick up the new cache content.

    1a) But reloading a page effectively pulls the cache contents. Thus the swapCache() call is a waste of time if you plan to reload the current page after the update completes – which phoneui does.

    Given this, phoneui.js omits explict call to swapCache() during the updateready() handler

    I hope this is helpful.

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: Cache problem

You must be logged in to post in the forum log in