0

As I read here http://www.niallkennedy.com/blog/2008/02/iphone-cache-performance.html all is gone after reboot.

So can local storage be used to keep persistence somehow even after reboot (in UIWebView with a bit of Objective-C maybe) ? If yes any example ?

user310291
  • 36,946
  • 82
  • 271
  • 487
  • You can use NSHTTPCookieStorage. Chech this [SO][1] Q&A. [1]: http://stackoverflow.com/questions/4597763/persisting-cookies-in-an-ios-application – user523234 Feb 16 '12 at 10:19

1 Answers1

1

Yes, you can just write to the application documents directory. This will persist through reboots.

NSArray *paths = NSSearchPathForDirectoriesInDomains(
   NSDocumentDirectory,
   NSUserDomainMask, 
   YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:fileName];

[yourFile writeToFile:filePath atomically:YES];
Mundi
  • 79,884
  • 17
  • 117
  • 140