1

I've been stuck with an issue that causes my code to crash on iOS 8. It works fine on iOS 7 but for some odd reason crashes on iOS 8. I've debugged the code until I found out where it crashes... This is the function in which it crashes:

- (void)reloadData
{
    NSLog(@"BPT:\nreloadData Start");
    oldDelegate = tableView.delegate;
    tableView.delegate = self;

    NSLog(@"BPT:\ntable: %@", tableView);
    NSLog(@"BPT:\nreloadData 1");
    [tableView setEditing:YES animated:YES];
    NSLog(@"BPT:\nreloadData End");
}

It crashes on:

[tableView setEditing:YES animated:YES];

Here is the log:

BPT:
reloadData Start
BPT:nreloadData 1
BPT:
table: <UITableView: 0x169f1800; frame = (0 0; 308 1024); autoresize = W+H; gestureRecognizers = <NSArray: 0x15d9b6c0>; layer = <CALayer: 0x15d9a260>; contentOffset: {0, -323.5}; contentSize: {308, 4255.5}>
BPT:
reloadData 1
Dec 2 22:09:35 ReportCrash[13733]...

This is the crash report: https://ghostbin.com/paste/2sq95

It shows that the application crashes when the code found at: 0x1654 in the dylib runs. But when I view this in IDA, this is what I find:

__text:0000172C sub_172C
__text:0000172C
__text:0000172C var_8           = -8
__text:0000172C var_4           = -4
__text:0000172C
__text:0000172C                 STR             R12, [SP,#var_4]!
__text:00001730                 LDR             R12, =(off_46D8 - 0x173C)
__text:00001734                 LDR             R12, [PC,R12] ; off_46D8
__text:00001738                 STR             R12, [SP,#4+var_8]!
__text:0000173C                 LDR             R12, =(unk_4000 - 0x1748)
__text:00001740                 LDR             PC, [PC,R12]
__text:00001740 ; End of function sub_172C

This function doesn't have any xrefs at all! It's not an initializer as well, cause the code initializes properly... Any help would be greatly appreciated... Why does: [tableView setEditing:YES animated:YES]; Cause a crash on iOS 8 and not iOS 7 Oo This error makes me crazy.

Brave Heart
  • 517
  • 3
  • 16
  • SIGSEGV error appears when application is trying to access object that is already deallocated. In my opinion you should check tableView object lifecycle – MP23 Dec 03 '14 at 12:25
  • But the log shows that the tableView object is still allocated and its values are logged... – Brave Heart Dec 03 '14 at 12:37
  • 1
    Hm, then maybe something is mixed up with delegates. I can see that you are switching delegates - is it possible that you can try to run this code without changing tableView delegate? – MP23 Dec 03 '14 at 12:44
  • ant code written in - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {}that method – Aruna kumari Dec 03 '14 at 12:46
  • @MP23 I can remove the delegate switching and make it so that I hook into and edit the current available code... But some functions aren't implemented so I'd have to use %new, which would cause issues since other tweaks may have created this function. (btw, this is a tweak tweaking the Settings Application. This is a video showing what it does: http://www.youtube.com/watch?v=ytB4DdKR8nI ) – Brave Heart Dec 03 '14 at 13:14
  • @Arunakumari I don't implement that function. But it works properly on iOS 7... so I think that's not the reason why it crashes... – Brave Heart Dec 03 '14 at 13:15

1 Answers1

0

I moved the whole code over so that I don't have to change the delegates as @MP23 said, and it all worked ^__^ It no longer crashes. Thanks a lot m8

Brave Heart
  • 517
  • 3
  • 16