[UIActivityIndicatorView _applicationDidEnterBackground:]: message sent to deallocated instance 0x48

来源:互联网 发布:软件安全性测试文档 编辑:程序博客网 时间:2024/05/16 00:36

问题: 在真机测试项目的时候只在iphone4s的测试机上crash, 进入后台就crash, 进入后台的两个方法体不做任何操作也crash

解决办法: 问题出在AFNetworking框架中

UIActivityIndicatorView+AFNetworking.m分类中

-(void)dealloc{    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000    [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil];    [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil];    [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil];#endif        [notificationCenter removeObserver:self name:AFNetworkingOperationDidStartNotification object:nil];    [notificationCenter removeObserver:self name:AFNetworkingOperationDidFinishNotification object:nil];}

将这个方法注释掉, 因为没用到这个分类所以不会有什么影响

0 0
原创粉丝点击