Advertisement
Guest User

Untitled

a guest
May 4th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. WebPreferences* prefs = [webView preferences];
  2. [prefs _setLocalStorageDatabasePath:@"~/Library/Application Support/MyApp"];
  3. [prefs setLocalStorageEnabled:YES];
  4.  
  5. WebPreferences* prefs = [webView preferences];
  6. [prefs _setLocalStorageDatabasePath:@"~/Library/Application Support/MyApp"];
  7. [prefs setLocalStorageEnabled:YES];
  8.  
  9. static NSString* _storageDirectoryPath();
  10. + (NSString *)_storageDirectoryPath;
  11.  
  12. #include "WebStorageManagerPrivate.h"
  13.  
  14. #include "WebPreferencesPrivate.h"
  15.  
  16. NSString* dbPath = [WebStorageManager _storageDirectoryPath];
  17.  
  18. WebPreferences* prefs = [self.webView preferences];
  19. NSString* localDBPath = [prefs _localStorageDatabasePath];
  20.  
  21. // PATHS MUST MATCH!!!! otherwise localstorage file is erased when starting program
  22. if( [localDBPath isEqualToString:dbPath] == NO) {
  23. [prefs setAutosaves:YES]; //SET PREFS AUTOSAVE FIRST otherwise settings aren't saved.
  24. // Define application cache quota
  25. static const unsigned long long defaultTotalQuota = 10 * 1024 * 1024; // 10MB
  26. static const unsigned long long defaultOriginQuota = 5 * 1024 * 1024; // 5MB
  27. [prefs setApplicationCacheTotalQuota:defaultTotalQuota];
  28. [prefs setApplicationCacheDefaultOriginQuota:defaultOriginQuota];
  29.  
  30. [prefs setWebGLEnabled:YES];
  31. [prefs setOfflineWebApplicationCacheEnabled:YES];
  32.  
  33. [prefs setDatabasesEnabled:YES];
  34. [prefs setDeveloperExtrasEnabled:[[NSUserDefaults standardUserDefaults] boolForKey: @"developer"]];
  35. #ifdef DEBUG
  36. [prefs setDeveloperExtrasEnabled:YES];
  37. #endif
  38. [prefs _setLocalStorageDatabasePath:dbPath];
  39. [prefs setLocalStorageEnabled:YES];
  40.  
  41. [self.webView setPreferences:prefs];
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement