objective c - Caching with NSMutableDictionary -
i new caching thing, , want cache (just when app still open) arrays of data. can tell me how using nsmutabledictionnary ?
thanks.
nsmutabledictionary
collection type allows store data via key/value pairs. key of pair search , value want retrieve. if have key named dob
may expect value of "1-19-1989".
if want cache right @ beginning of start in applicationdidfinishlaunchingwithoptions:
in appdelegate file. go this...
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { //// whatever data need nsstring *key = @"dob"; nsstring *value = @"1-19-89"; // place dictionary nsdictionary *dictionary = @{key: value}; // , nsmutabledictionary nsmutabledictionary *mutabledictionary = [nsmutabledictionary new]; [mutabledictionary setobject:value forkey:key]; return yes; }
and @abhinav said, can either store nsuserdefaults
small data , advise coredata
large amounts of data.
Comments
Post a Comment