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
Post a Comment