Closed springlo closed 8 years ago
Debug with the zombies instrument.
LtekiMacBook-Pro:~ lc$ malloc_history 4203 0x7fa3a278bd90 malloc_history Report Version: 2.0 Invalid connection: com.apple.coresymbolicationd ALLOC 0x7fa3a278bd90-0x7fa3a278bf27 [size=408]: thread_10f43e300 |start | main | UIApplicationMain | GSEventRunModal | CFRunLoopRunSpecific | CFRunLoopRun | CFRunLoopDoSources0 | CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION | _UIApplicationHandleEventQueue | _UIApplicationHandleEventFromQueueEvent | -[UIApplication sendEvent:] | -[UIWindow sendEvent:] | -[UIWindow _sendGesturesForEvent:] | _UIGestureRecognizerUpdate | -[UIControl touchesEnded:withEvent:] | -[UIControl _sendActionsForEvents:withEvent:] | -[UIApplication sendAction:to:from:forEvent:] | -[LoginViewController Login:] | +[MBProgressHUD showHUDAddedTo:animated:] | -[MBProgressHUD initWithView:] | -[MBProgressHUD initWithFrame:] | -[MBProgressHUD updateIndicators] | _objc_rootAlloc | class_createInstance | calloc | malloc_zone_calloc
Now,debug with the Zombies:
0 Malloc +1 1 00:04.683.365 FoodReDro -[MBProgressHUD updateIndicators] 1 Autorelease 00:04.685.896 FoodReDro -[MBProgressHUD initWithFrame:] 2 Retain +1 2 00:04.685.898 FoodReDro -[MBProgressHUD updateIndicators] 3 Retain +1 3 00:04.686.058 UIKit -[UIView(Internal) _addSubview:positioned:relativeTo:] 4 Retain +1 4 00:04.687.833 UIKit -[UIView(Hierarchy) subviews] Retain/Release (2) 00:04.694.223 QuartzCore -[CALayer layoutSublayers] 7 Release -1 3 00:04.717.678 UIKit _wrapRunLoopWithAutoreleasePoolHandler 8 Release -1 2 00:12.163.361 FoodReDro -[MBProgressHUD dealloc] 9 Release -1 1 00:12.163.413 UIKit -[UIView(Hierarchy) removeFromSuperview] 10 Release -1 0 00:12.163.524 GraphicsServices GSEventRunModal 11 Zombie -1 00:15.884.036 Foundation -[NSNotificationCenter postNotificationName:object:userInfo:]
Looks like NSNotificationCenter
is messaging a deallocated object. MBProgressHUD does use NSNotificationCenter
, but it removes itself from it in -[MBProgressHUD dealloc] which is there in your call tree. Are you sure it's not a memory issue in your app? Can you reproduce this in the demo app?
AppDelegate: self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.backgroundColor = [UIColor whiteColor]; ViewController controller = [[ViewController alloc] init]; UINavigationController nav = [[UINavigationController alloc] initWithRootViewController:controller]; self.window.rootViewController = nav; [self.window makeKeyAndVisible]; return YES;
ViewController:
It's crash when the hud is showing and toggle between the home key and the app. It's printed: *\ -[UIActivityIndicatorView _applicationDidEnterBackground:]: message sent to deallocated instance 0x13de1efe0
(my system:IOS 8.1.3 )