0

I am trying to remove all the objects from the NSMutableArray and I am reloading the UITableView. But it produces SIGABRT in cellForRowAtIndexPath. The code is given below.

if ([nsMutableArray count] != 0) {

        [nsMutableArray removeAllObjects];
        [tableView reloadData];
    }

It shows SIGABRT in

if (cell == nil) {

        cell = (UICustomCell *)[nsMutableArray objectAtIndex:indexPath.row];
    }

Help me to come out of this problem.

2 Answers 2

0

change this

to

if ([NSMutableArrayObject count] != 0) {
   [NSMutableArrayObject removeAllObjects];
   [tableView reloadData];
}

if (cell == nil) {
    cell = (UICustomCell *)[NSMutableArrayObject objectAtIndex:indexPath.row];
}
0
0

You are calling instance methods (count, removeAllObjects, reloadData, objectAtIndex:) on classes (NSMutableArray, UITableView) instead of object instances.

2
  • Use the variables that you (hopefully) have. Like NSMutableArray *myArray; myArray = ... ; if ([myArray count] != 0) { ... }
    – DarkDust
    Jul 25, 2011 at 14:58
  • OMG!!! I am using the object only. Just I used the class name here for the understanding purpose. I am using the objects of the classes mentioned in my code.
    – iOS
    Jul 26, 2011 at 6:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.