- [MyDictationController respondsToSelector:]消息已发送ot deallocated instance

时间:2016-12-28 13:41:33

标签: ios objective-c memory-management memory-leaks instruments

我的应用程序崩溃了这个堆栈跟踪:

[DictationDetailsController respondsToSelector:]: message sent to deallocated instance

我在试图查看导致崩溃的相关代码的工具上跟踪:

enter image description here

这是didSelectRowAtIndexPath:委托方法中MyDictationController的相关代码:

- (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;

我也使用过@synthesize。帮助我解决这个问题,以获取正在调用的解除分配方法。?

这是我的DictationDetailsController界面:

@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

dealloc方法中:

- (void)dealloc {
    [player pause];
    player = nil;
    self.dictation = nil;
}

1 个答案:

答案 0 :(得分:0)

我的猜测是问题出在GET_CONTROLLER_WITH_CLASS方法的某个地方。在该行上弹出一个断点并跳过它。它可能会生成一个已发布的类实例。在这种情况下,当它尝试访问该听写属性时,在该方法调用之后紧接着就会发生崩溃。