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

问题: 在真机测试项目的时候只在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];
}

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

你可能感兴趣的:([UIActivityIndicatorView _applicationDidEnterBackground:]: message sent to deallocated instance 0x48)