title: Storing & fetching the cached data from JSON webservice in iPhone
body: <p>I am looking to create a <strong>Cache Manager class for News</strong> which can be used in other iPhone projects also. My cache manager would support caching of JSON data i.e Text &amp; Image &amp; storing it locally in iPhone. The primary idea behind this is to enable the application access the cached data resulting in reducing the network activity.</p>
  
  <p>I am thinking to have this thing implement in the following ways :</p>
  
  <ol>
  <li><p>Sqlite Database i.e fetching all the data &amp; storing</p></li>
  <li><p>Adding this data to some .plist file</p></li>
  <li><p>Core-Data </p></li>
  </ol>
  
  <p><strong>I tried with this code for second solution:</strong></p>
  
  <pre><code>NSString *plistPath = [self Return_PlistPathCreation]; // Method to creat the JSON file locaally under Documents
  
      NSMutableDictionary *dict = [[NSMutableDictionary alloc]init];
      [dict setValue:newsArray forKey:@"homenews"]; //newsArray is the array containing objects parsed from the JSON webservice 
       NSLog(@"JSON representation for dictionary is %@",[dict JSONRepresentation]); //it prints perfectly
  
      [[dict JSONRepresentation] writeToFile:plistPath atomically:YES encoding:NSASCIIStringEncoding error:nil]; //Not not able to write it within the file 
  </code></pre>
  
  <p>What wrong with above code?</p>
  
  <p>So, which one would the better way for storing the cached data looking towards the performance &amp; responsiveness of the application? Though I am open to new ideas, if there are any other ways other than above?</p>