title: How to avoid unrecognised selector sent to NSCFArray sortUsingDescriptor: in iphone?
body: <p>I am new to iphone development .I am trying to sort a NSMutable array with reference to the date which is saved as object for the key "pubDate".After parsing the url i am saving the date as date format in an array"myPubDate".</p>
  
  <pre><code> (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{
  //NSLog(@"found characters: %@", string);
  // save the characters for the current item...
  if ([currentElement isEqualToString:@"title"]) {
      [currentTitle appendString:string];
  } else if ([currentElement isEqualToString:@"link"]) {
      [currentLink appendString:string];
  } else if ([currentElement isEqualToString:@"description"]) {
      [currentSummary appendString:string];
  } else if ([currentElement isEqualToString:@"pubDate"]) {
      [currentDate appendString:string];
      NSDateFormatter *df =[[NSDateFormatter alloc] init];
      [df setFormatterBehavior:NSDateFormatterBehavior10_4];
      [df setDateFormat:@"EEE, dd MMM yyyy"];
      myPubDate = [df dateFromString:currentDate];
  
  }
  
  
    - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{     
  //NSLog(@"ended element: %@", elementName);
  if ([elementName isEqualToString:@"item"]) {
          [item setObject:currentTitle forKey:@"title"];
              [item setObject:currentLink forKey:@"link"];
              [item setObject:currentSummary forKey:@"description"];
              [item setObject:myPubDateforKey:@"pubDate"] 
  
              [item setObject:currentImage forKey:@"imagePath"];
              NSLog(@"Befor if condition");
              [stories addObject:[item copy]];
          }
                          recent = [stories copy];}
  
   For sorting
      NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"pubDate" ascending:NO]; 
      [recent sortUsingDescriptor:[NSArray arrayWithObjects:descriptor, nil]];  
   recent1 = [recent sortedArrayUsingDescriptors:descriptor];
  [descriptor release];
  </code></pre>
  
  <p>I am geeting an error in the console as</p>
  
  <p>[NSCFArray sortUsingDescriptor:]: unrecognized selector sent to instance 0x4ed10c0</p>
  
  <p>Where do i go wrong? please help me out.Thanks.</p>