I currently use a Subclass of NSCache to store some images (values) with their corresponding names (Keys) and it seems to work fine, when the app is in the foreground. However, when I press the home button/the user enters the background and I reenter the app, the NSCache is empty.
Implementation details: I implemented my subclass of NSCache as a Singleton. This ensures that there should be only one instance of that class, which should be accessible from anywhere in the program by simply calling the class name along with the shared implementation. [HelloCache sharedCache]
. Here HelloCache is the name of the subclass and sharedCache is the shared Cache.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…