title: -[__NSDictionaryI rangeOfString:options:]: unrecognized selector sent to instance
body: <p>I have a <code>UISearchBar</code> within a <code>UITableView</code> and when it's tapped and you start typing, it will auto-update the list. I have an NSMutableArray named <code>_cloudItems</code> which returns a JSON (I am using <a href="https://github.com/jnjosh/JJCloudEngine" rel="nofollow">JJCloudEngine</a> to retrieve the JSON string).</p>
  
  <p>Most of the code in the project is fine, expect this block of code that is giving me this error: <code>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI rangeOfString:options:]: unrecognized selector sent to instance 0x17e343e0'</code></p>
  
  <pre><code>-(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
  
      if (searchText.length == 0) {
          // Set bollean flag
          isFiltered = NO;
      } else {
          // Set boolean flag
          isFiltered = YES;
  
          // Alloc and init our fliteredData
          filteredList = [[NSMutableArray alloc] init];
  
          // Fast enumeration
          for (NSString *name in _cloudItems) {
              NSRange nameRange = [name rangeOfString:searchText options:NSCaseInsensitiveSearch];
              if (nameRange.location != NSNotFound) {
                  [filteredList addObject:name];
  
              }
          }
      }
      // Reload tableView
      [table reloadData];
  
  }
  </code></pre>
  
  <p>I am aware that these two lines of code are the cause of the problem:</p>
  
  <pre><code>for (NSString *name in _cloudItems) {
                  if (nameRange.location != NSNotFound) {
  </code></pre>
  
  <p>NOTE: <code>_cloudItems</code> is an <code>NSMutableArray</code> and gets it's code from this block of code:</p>
  
  <pre><code>- (void)itemsRecieved:(NSArray *)items forRequest:(NSString *)connectionId {
  
      NSLog(@"cloud engine recieved items on request %@", connectionId);
      _cloudItems = items;
      [table reloadData];
  
  }
  </code></pre>
  
  <p>I have tried changing <code>for (NSString *name in _cloudItems) {</code> into <code>NSArray</code> and <code>NSMutableArray</code> and they don't work. I have also added this:</p>
  
  <pre><code>NSDictionary *dictItem = [_cloudItems objectAtIndex:indexPath.row];
  
  for (NSString *name in dictItem) {
  </code></pre>
  
  <p>But this error message happens:</p>
  
  <p><code>Use of undeclared identifier 'indexPath'; did you mean 'NSIndexPath'?</code></p>
  
  <p>What am I doing wrong? Any help is appreciated. Thank you.</p>