I am new to NSCache, I want to cache the response data and use it. So my [cache setobject]
is in class A and I need to get it from class B using [cache objectForKey]
. But it is always NULL
.It works in same class as 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 to get that from different class?