我的应用程序崩溃,堆栈跟踪:
[DictationDetailsController respondsToSelector:]: message sent to deallocated instance我在仪器上跟踪了它,试图看到导致崩溃的相关代码:

下面是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;
}发布于 2016-12-28 22:18:00
我猜问题出在GET_CONTROLLER_WITH_CLASS方法内部的某个地方。在该行上弹出一个断点并跳过它。它可能正在生成类的已发布实例。在这种情况下,当该方法试图访问口述属性时,崩溃将发生在调用该方法之后的行上。
https://stackoverflow.com/questions/41363338
复制相似问题