Search Results

Search found 1 results on 1 pages for 'kalkin'.

Page 1/1 | 1 

  • objectAtIndex:indexPath.row method always causes exception in IOS

    - by kalkin
    Hi I always seem to get exception when I use objectAtInded method to retrieve NSString from an array. I am reading data from a dictionary which is in the "PropertyList.plist" file.My code is - (void)viewDidLoad { [super viewDidLoad]; NSString *path = [[NSBundle mainBundle] pathForResource:@"PropertyList" ofType:@"plist"]; names = [[NSDictionary alloc] initWithContentsOfFile:path]; keys = [[[names allKeys] sortedArrayUsingSelector: @selector(compare:)] retain]; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger section = [indexPath section]; NSUInteger row = [indexPath row]; NSString *key = [keys objectAtIndex:section]; NSArray *nameSection = [names objectForKey:key]; static NSString *SectionsTableIdentifier = @"SectionsTableIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SectionsTableIdentifier]; if(cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SectionsTableIdentifier] autorelease]; } cell.textLabel.text = [nameSection objectAtIndex:row]; return cell; } The exception happens on the method "cellForRowAtIndexPath" in the line cell.textLabel.text = [nameSection objectAtIndex:row]; The error message is Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance 0x6832440 Where ever I use "[nameSection objectAtIndex:row];" type of statement it always get exception.

    Read the article

1