Reading Structures Produced by RSS Importer

adamfenn28's picture

I'm trying to read the titles of an RSS feed, through the structure that RSS Importer creates. Here's my code:

   for (i=0; i < maxArticles; i++) {
      key = [NSString stringWithFormat:@"%i", i];
      thisDictionary = [dictionary objectForKey:key];
      thisResult = [NSString stringWithFormat:@"%@", [thisDictionary objectForKey:@"title"]];
      NSLog(@"thisResult: %@", thisResult);
   }
 

it seems pretty simple, but when I run it, it says all my titles are null. I can't seem to read the structure's within the structures. Here's my log:

2011-04-12 17:04:55.918 Quartz Composer[32569:a0f] thisResult: (null)
2011-04-12 17:04:55.918 Quartz Composer[32569:a0f] thisResult: (null)
2011-04-12 17:04:55.918 Quartz Composer[32569:a0f] thisResult: (null)

Is this output structure not a NSDictionary of NSDictionaries? Am I overlooking something super obvious?

Thanks!

adamfenn28's picture
Re: Reading Structures Produced by RSS Importer

Problems identified!

  1. The output is not a NSDictionary of NSDictionaries. It's a NSArray of NSDictionaries.

  2. The bug that @cwright pointed me to on another thread (http://kineme.net/forum/Discussion/Programming/NSDictionaryturnsintoNSCF...) strips they keys off of dictionaries embedded in arrays.