You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by mm...@apache.org on 2012/09/26 16:49:02 UTC

ios commit: [ios] Fixing LocalStorage not persisting on first app launch on ios6

Updated Branches:
  refs/heads/master 4ab9c41ed -> 1a6093513


[ios] Fixing LocalStorage not persisting on first app launch on ios6

Fixes: https://issues.apache.org/jira/browse/CB-1535#comment-13463843


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/1a609351
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/1a609351
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/1a609351

Branch: refs/heads/master
Commit: 1a6093513c51a817d1ef97ff87cb140519966e4d
Parents: 4ab9c41
Author: Michal Mocny <mm...@gmail.com>
Authored: Wed Sep 26 10:47:49 2012 -0400
Committer: Michal Mocny <mm...@gmail.com>
Committed: Wed Sep 26 10:47:49 2012 -0400

----------------------------------------------------------------------
 CordovaLib/Classes/CDVViewController.m |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/1a609351/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index bd444d5..646818d 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -198,6 +198,12 @@
         [CDVLocalStorage __verifyAndFixDatabaseLocations];
     }
 
+    if (IsAtLeastiOSVersion(@"6.0")) {
+        // We don't manually back anything up in 6.0 and so we should remove any old backups.
+        [CDVLocalStorage __restoreThenRemoveBackupLocations];
+        [[NSUserDefaults standardUserDefaults] setBool:backupWebStorage forKey:@"WebKitStoreWebDataForBackup"];
+    }
+
     // // Instantiate the WebView ///////////////
 
     [self createGapView];
@@ -223,13 +229,9 @@
     }
 
     /*
-     * Fire up CDVLocalStorage on iOS 5.1 to work-around WebKit storage limitations, or adjust set user defaults on iOS 6.0+
+     * Fire up CDVLocalStorage on iOS 5.1 to work-around WebKit storage limitations
      */
-    if (IsAtLeastiOSVersion(@"6.0")) {
-        // We don't manually back anything up in 6.0 and so we should remove any old backups.
-        [CDVLocalStorage __restoreThenRemoveBackupLocations];
-        [[NSUserDefaults standardUserDefaults] setBool:backupWebStorage forKey:@"WebKitStoreWebDataForBackup"];
-    } else {
+    if (!IsAtLeastiOSVersion(@"6.0")) {
         if (backupWebStorage) {
             [self.commandDelegate registerPlugin:[[CDVLocalStorage alloc] initWithWebView:self.webView] withClassName:NSStringFromClass([CDVLocalStorage class])];
         } else {