title: NSPredicate on NSDictionary
body: <p>I'm trying to make sections in a table view based on the alphabet and sort my entries alphabetically under these sections.</p>
  
  <p>I have collected the first letter in every entry of bandsArray in bandsArrayIndex and I'm now trying to use NSPredicate to count how many of each letter there are.</p>
  
  <p>I'm doing this by following <a href="http://www.devx.com/wireless/Article/43374">this guide</a>.</p>
  
  <p>They are using an NSArray and I'm using an NSDictionary and can't seem to get it to work. Can anyone help me out?</p>
  
  <p>The application crashes when trying to show the view with the table view in it.
  In Debugger Console the following error is shown:</p>
  
  <blockquote>
    <p><em>*</em> Terminating app due to uncaught exception
    'NSInvalidArgumentException', reason:
    'Can't do a substring operation with
    something that isn't a string</p>
  </blockquote>
  
  <p>This is my code</p>
  
  <pre><code>- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
      NSString *alphabet = [bandsArrayIndex objectAtIndex:section];
      NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF beginswith[c] %@", alphabet];
      NSArray *letters = [bandsArray filteredArrayUsingPredicate:predicate];
  
      return [letters count];
  }
  </code></pre>
  
  <p>EDIT: This is my bandsArray.</p>
  
  <p>The header</p>
  
  <pre><code>NSMutableArray *bandsArray;
  
  @property (nonatomic, retain) NSMutableArray* bandsArray;
  </code></pre>
  
  <p>The implementation</p>
  
  <pre><code>// set array from plist
  NSString *path = [[NSBundle mainBundle] pathForResource:@"Bands" ofType:@"plist"];
  NSMutableArray* tmpArray = [[NSMutableArray alloc] initWithContentsOfFile:path];
  
  self.bandsArray = tmpArray;
  
  // sort array after name ascending
  NSSortDescriptor *nameSorter = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES selector:@selector(caseInsensitiveCompare:)];
  [bandsArray sortUsingDescriptors:[NSArray arrayWithObject:nameSorter]];
  </code></pre>