tags:

views:

39

answers:

1

The title kinda asks for it all. The function:

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source.
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view.
    }   
}

Creates the error in the console:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString count]: unrecognized selector sent to instance 0x0000000'
A: 

Somewhere you're calling count on an instance of NSString, which doesn't support this selector. The place where this happens isn't in the code you gave us, though.

Douwe Maan
No, I'm only calling count on a NSMutableArray object. It is here: - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [projects count]; }I searched my entire project for "count" and it only occurred there.
Hankweb
How sure are you `projects` is an `NSArray` there? The error message is very clear... `'-[NSCFString count]: unrecognized selector sent to instance 0x0000000'`
Douwe Maan
#import <UIKit/UIKit.h>@interface RootViewController : UITableViewController { NSMutableArray *projects;}@property (nonatomic, assign) NSMutableArray *projects;@end
Hankweb
Maybe you could update your post with some more code? I don't immediately see the problem in those snippets, but there clearly is a problem with `projects` somewhere...
Douwe Maan
I did an `NSLog(@"%@", projects);` before the `return [projects count]` and the first time it is the normal array, but the second time, it is randomly the string "fr.iproj"
Hankweb
Okay, I got it, just it does not work in the iPhone Simulator, which kinda makes me mad.
Hankweb

related questions