ios - How to do in-memory and on disk data caching in watchkit extension? -


i have ios app sends data in key value pairs watchkit extension, want cache key value pairs both in memory , on disk @ watchkit extension. best way this?

because you're using key/value pairs, seems straightforward keep data in nsdictionary while in-memory. persist dictionary disk:

[mydictionary writetofile:@"myfile" atomically:yes]; 

to load dictionary disk:

nsmutabledictionary *mydictionary =   [nsmutabledictionary dictionarywithcontentsoffile:@"myfile"]; 

for it's worth, nsarray supports same functionality.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -