2

Inserting object causing crash on next line "//Crashing".

NSUInteger count=indexPath.row+1;
        NSMutableArray *arCells=[NSMutableArray array];
        for(NSDictionary *dInner in ar ) {
            [arCells addObject:[NSIndexPath indexPathForRow:count inSection:0]];
            if (tableView == self.searchDisplayController.searchResultsTableView)
              //crashing
              //  [self.FilterArray insertObject:dInner atIndex:count++];
            else
                [self.arForTable insertObject:dInner atIndex:count++];
            [insertedIndexPath addObject:[NSIndexPath indexPathForRow:count inSection:0]];
        }

Crash Log:-

-[__NSArrayI insertObject:atIndex:]: unrecognized selector sent to instance 0x9c754c0 2013-06-19 00:16:05.092 RA[2067:c07] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI insertObject:atIndex:]: unrecognized selector sent to instance 0x9c754c0' * First throw call stack: (0x24a9012 0x198be7e 0x25344bd 0x2498bbc 0x249894e 0xeb4d 0x97f285 0x97f4ed 0x13895b3 0x2468376 0x2467e06 0x244fa82 0x244ef44 0x244ee1b 0x26e17e3 0x26e1668 0x8cfffc 0x2a4d 0x2975) libc++abi.dylib: terminate called throwing an exception

Filter Array is mutable array which have object from the search result.I am UISearchdisplaycontroller.

1 Answer 1

3

Sounds like your @property declaration for arForTable does not have a strong attribute so there's no retention

Sign up to request clarification or add additional context in comments.

6 Comments

it's crashing for Filterarray only and property have the retain attribute.
This error 'unrecognized selector sent to instance' typically mean the object receiving the message isn't what you think it is. And typically, this means the address got dereferenced and reassigned to another object. So you have a retain count problem somewhere.
arForTable has the strong property also and in normal way it's working but when it comes in search mode.it crashes.I understand that what you have mention.
for (id obj in (NSMutableArray*)[self.arForTable filteredArrayUsingPredicate:predicate ]) { [self.FilterArray addObject:obj]; }
adding search object like this working for me but if i assigned it directly causing crashing.any idea?
|

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.