在我的 UIViewController 中,我添加了一个包含 uitableview 的 subview 。
MSEmployeeServiceController *empServices = [[MSEmployeeServiceController alloc]initWithNibName:@"MSEmployeeServiceController" bundle:nil];
[self.totScroll addSubview:empServices.view];
MSEmployeeServiceController
类包含一个 UITableView
。当我尝试添加 View 应用时崩溃并出现以下错误:
-[MSEmployeeServiceController numberOfSectionsInTableView:]: message sent to deallocated instance 0x8684030
我已经在 View 中设置了数据源和委托(delegate)连接。 请帮助我。
最佳答案
如果您使用的是 ARC,请在您的头文件
中将MSEmployeeServiceController
的对象设为这样的属性
@property (strong, nonatomic) MSEmployeeServiceController *empServices;
然后在你的实现文件中,
_empServices = [[MSEmployeeServiceController alloc]initWithNibName:@"MSEmployeeServiceController" bundle:nil];
[self.totScroll addSubview:empServices.view];
关于iphone - 应用程序崩溃并发送到已释放实例的错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17967511/