Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9509] iOS: webview local storage broken after app update on iOS 5.1

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionNot Our Bug
Resolution Date2012-09-06T16:56:08.000+0000
Affected Version/sRelease 2.1.0, Release 1.8.2, Release 2.0.1
Fix Version/sSprint 2012-17 Core, Sprint 2012-18 Core
ComponentsiOS
Labelscore
ReporterFederico Casali
AssigneeMax Stepanov
Created2012-06-12T19:45:01.000+0000
Updated2013-03-13T15:06:23.000+0000

Description

Problem description

Webview local storage it's broken on iOS 5.1. Performing an App update, local storage for webview it's no longer persistant.

Steps to reproduce and sample code

1. Run the sample code, run the app and click "add" a few times Result: The data is shown and being stored in local storage 2. Close completely the app and restart app Result: stored data is correctly shown 3. Install over the app from Xcode Result: contents it's no longer available. Also, subsequently added data (like in step 1 and 2) it's no longer kept in the local storage. Attaching also log file
//  app.js

var win1 = Titanium.UI.createWindow({  
    backgroundColor:'#fff'
});

var webview = Ti.UI.createWebView({
  url: '/localstorage.html'
});

win1.add(webview);
win1.open();	
// localstorage.html

<html>
  <head>
    <meta name="viewport" content="width=device-width, maximum-scale=1.0, initial-scale=1.0">
    <script type="text/javascript">
      if(!localStorage["offline_submissions"]) {
        localStorage["offline_submissions"] = JSON.stringify([]);
      }

      var submissions = JSON.parse(localStorage["offline_submissions"]);

      var show = function(){
        var al = document.getElementById('alertbox');
        al.innerHTML = submissions.map(function(x){return x.a;});
      }

      var addItem = function(){
        submissions.push({a: (new Date()).toString()});
        localStorage["offline_submissions"] = JSON.stringify(submissions);
        show();
      }

      show();
    </script>
  </head>
  <body>
    <div id='alertbox'></div>

    <input type="button" onClick='addItem();' value="add"/>
    <br/>
    <br/>
    <input type="button" onClick='localStorage["offline_submissions"] = JSON.stringify([]);' value="clear"/>
  </body>

  <script type="text/javascript">
    show();
  </script>
</html>

Additional notes

Customer ticket: http://support-admin.appcelerator.com/display/APP-523422

Attachments

FileDateSize
localStorageLOG.log2012-06-12T19:46:15.000+00007424

Comments

  1. Max Stepanov 2012-08-23

    Unable to reproduce following the provided steps.
  2. Max Stepanov 2012-09-04

    It seems to be related to this: http://forrst.com/posts/Security_err_dom_exception_18_and_how_to_avoid-1Ge http://www.iphonewarroom.com/2012/07/how-to-fix-iphone-securityerr-dom.html
  3. Max Stepanov 2012-09-06

    Unable to reproduce when update app via iTunes, or iPhone Configuration Utility or Xcode Run/Debug. Could reproduce via XCode Organizer, Devices tab, Add button. This problem is somehow related to the way application is updated. Probably installing via Xcode Organizer does not update the app properly.
  4. Natalie Huynh 2012-12-04

    Closing as not our bug

JSON Source