0

My app crashes with this stack trace:

[DictationDetailsController respondsToSelector:]: message sent to deallocated instance

I tracked that on instruments trying to see the relevant code causing the crash:

enter image description here

here is the relevant code for MyDictationController in the didSelectRowAtIndexPath: delegate method:

- (void)tableView:(UITableView )tableView didSelectRowAtIndexPath:(NSIndexPath )indexPath {
        DictationDetailsController *controller = GET_CONTROLLER_WITH_CLASS([DictationDetailsController class]);
        controller.dictation = [unSubmittedDictations objectAtIndex:indexPath.row];
        controller.isEditMode = YES;
        controller.selectedDate = _selectedDate;
        controller.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:controller animated:YES];
}

@property (copy ,nonatomic) Dictation *dictation;

Also i have used @synthesize. Help me out in this issue, to get which deallocated method is being called.?

Here's my DictationDetailsController interface:

@interface DictationDetailsController : BaseController

@property (copy ,nonatomic) Dictation *dictation;
@property (nonatomic) BOOL isEditMode;
@property (nonatomic) NSDate *selectedDate;

@property (weak, nonatomic) IBOutlet UILabel *navigationTitleLabel;
@property (weak, nonatomic) IBOutlet UITextField *patientNameTextField;
@property (weak, nonatomic) IBOutlet UITextField *accountIDTextField;
@property (weak, nonatomic) IBOutlet UITextField *workTypeTextField;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *deleteButtonWidth;
@property (weak, nonatomic) IBOutlet UIView *tutorialView;
@property (weak, nonatomic) IBOutlet UIView *audioContainer;
@property (weak, nonatomic) IBOutlet UISlider *audioSlider;
@property (weak, nonatomic) IBOutlet UILabel *durationLabel;
@property (weak, nonatomic) IBOutlet UILabel *noRecordingLabel;
@property (weak, nonatomic) IBOutlet UIButton *playPauseButton;

@end

And in dealloc method:

- (void)dealloc {
    [player pause];
    player = nil;
    self.dictation = nil;
}
Umair Suraj
  • 480
  • 11
  • 22
  • enable zombie. it just means that you are still keeping a zombified instance and still trying to call a method to it. remember glenn was already killed in the walking dead :( – Joshua Dec 29 '16 at 03:33
  • I have enable zoombie. And its says '[DictationDetailsController respondsToSelector:]: message sent to deallocated instance'. How can i find exact method that is being called.? – Umair Suraj Dec 29 '16 at 05:43
  • I know there is some method that is being called in 'DictationDetailsController'. Although controller is popped. Dont know which method is being called. Even stack trace is not helping me. – Umair Suraj Dec 29 '16 at 05:45
  • well it seems that you are still keeping a strong reference to some of its properties. maybe you can show your interface for DictationDetailsController? – Joshua Dec 29 '16 at 05:46
  • is dealloc being called? you can put a breakpoint there to check when you pop the VC – Joshua Dec 29 '16 at 06:00
  • Yup dealloc is being called on Pop. – Umair Suraj Dec 29 '16 at 06:01
  • I think you can check this: http://stackoverflow.com/a/5087675/2301271 it describes why you are getting deallocated instance. its just hard to check why with limited code. it can happen during some process in the detailedVC that you are performing, or the main vc that handles your detailedVC – Joshua Dec 29 '16 at 06:05

1 Answers1

0

My guess is the issue is somewhere inside GET_CONTROLLER_WITH_CLASS method. Pop a breakpoint on that line and step over it. It's possibly producing a released instance of the class. That being the case, the crash would occur on the line immediately following the call to that method when it tries to access the dictation property.

Chris Terry
  • 161
  • 1
  • 5