ios - NSCache get object from another class -


i new nscache, want cache response data , use it. [cache setobject] in class , need class b using [cache objectforkey]. null.it works in same class below..

nsurl *url = [nsurl urlwithstring:@"http://ios.eezytutorials.com/sample-files/sample-dictionary-plist.plist"]; nsdictionary *dict = [[nsdictionary alloc]initwithcontentsofurl:url]; nscache *cache = [[nscache alloc]init]; [cache setobject:dict forkey:url]; nslog(@"%@",[cache objectforkey:url]); 

how different class?

nscache not singleton or shared instance. if want use contents of specific instance, place nscache instance on appdelegate or create own singleton class manage it.


Comments