您的位置:首页 > 移动开发

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

2016-02-03 11:11 573 查看
问题: 在真机测试项目的时候只在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];
}


将这个方法注释掉, 因为没用到这个分类所以不会有什么影响
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: