Objective c with iOS15 tableView expandable

Hey Team,

if (self.selectedIndex==-1)
  {
NSIndexPath *prev = [NSIndexPath indexPathForRow:self.selectedIndex inSection:0];
   
self.selectedIndex=indexPath.row;

[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:prev] withRowAnimation:UITableViewRowAnimationFade];

}

Now, this below code gave me a crash in iOS 14 & iOS 15. But it is working fine with iOS 13. Could you please provide me with an alternate of this?

[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:prev] withRowAnimation:UITableViewRowAnimationFade];

Please show the full crash report for the above code.

I don't understand your code

if (self.selectedIndex==-1)  {
    NSIndexPath *prev = [NSIndexPath indexPathForRow:self.selectedIndex inSection:0];

WIth selectedIndex==-1, what is value of previous (null ?)

Add a log to test for prev.

Objective c with iOS15 tableView expandable
 
 
Q