storage - How to store temporary values/objects per session in iOS app -



storage - How to store temporary values/objects per session in iOS app -

so i've got hybrid e-commerce ios app i'm working on, , need store multiple string / array values temporarily duration of checkout process. if user leaves checkout process, want these values either deleted or reset. otherwise, @ periods of time during checkout process want able retrieve these values , utilize them.

what's best way accomplish this? core info seems little more permanent i'm looking for, might right way go. can store stuff in there , delete when user leaves checkout process, i'm wondering if there's improve way it, basically.

a note hybrid part:

when user clicks "checkout", launch webview , checkout process continues there. i have info retrieval class (instantiated via js bridge) retrieves data, class goes out of memory it's done retrieving data i need access said info javascript in multiple separate parts, after info retrieval class has gone out of memory

so, taking consideration, best place me store info retrieved info retrieval class? sample code, of course, welcome :). thanks!

if info you're retrieving webview key-value pairs, need not set core info that. can utilize nsuserdefaults store data. can save settings , properties related application or user info using nsuserdefaults. values saved entire scope of application can reset values 1 time you're done reading values in checkout process.

here how save info using nsuserdefaults -

nsuserdefaults* defaults = [nsuserdefaults standarduserdefaults]; [defaults setobject:firstname forkey:@"firstname"]; [defaults synchronize];

you can utilize next code retrieve info -

nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; nsstring *firstname = [defaults objectforkey:@"firstname"];

ios storage temporary-objects

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -