mutualmobile / MMProgressHUD

An easy-to-use HUD interface with personality.
MIT License
705 stars 131 forks source link

MMProgressHUDPresentationStyleNone causes UIViewControllerHierarchyInconsistency exception #6

Closed jpaas closed 11 years ago

jpaas commented 11 years ago

Try the following...

[MMProgressHUD setPresentationStyle:MMProgressHUDPresentationStyleNone]; [MMProgressHUD showWithTitle:@"Step 1" status:@""]; [MMProgressHUD dismiss]; [MMProgressHUD showWithTitle:@"Step 2" status:@""]; [MMProgressHUD dismiss];

The 2nd time show try to show the HUD, you'll get...

2013-09-30 15:03:01.880 selfpay-ios[11297:a0b] MMProgressHUD [line 104]: Beginning MMProgressHUD show... 2013-09-30 15:04:06.515 selfpay-ios[11297:a0b] * Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! View <MMProgressHUD: 0xcb4dd70; frame = (0 0; 320 480); autoresize = W+H; gestureRecognizers = <NSArray: 0xcb59470>; layer = <CALayer: 0xcb4dec0>> is associated with <MMProgressHUDViewController: 0xda2fca0>. Clear this association before associating this view with <MMProgressHUDViewController: 0xda30f80>.' * First throw call stack: ( 0 CoreFoundation 0x0321c5e4 exceptionPreprocess + 180 1 libobjc.A.dylib 0x02f9f8b6 objc_exception_throw + 44 2 CoreFoundation 0x0321c3bb +[NSException raise:format:] + 139 3 UIKit 0x01ccb809 -[UIView(Internal) _setViewDelegate:] + 242 4 UIKit 0x01d7d55c +[UIViewController setViewController:forView:] + 40 5 UIKit 0x01d77fb1 -[UIViewController setView:] + 511 6 selfpay-ios 0x00118bee -[MMProgressHUDViewController setView:] + 126 7 selfpay-ios 0x00113637 -[MMProgressHUD _buildHUDWindow] + 263 8 selfpay-ios 0x001139e1 -[MMProgressHUD _buildHUD] + 113 9 selfpay-ios 0x00114d62 -[MMProgressHUD show] + 594 10 selfpay-ios 0x00111ae2 -[MMProgressHUD showWithTitle:status:confirmationMessage:cancelBlock:progressStyle:] + 1026 11 selfpay-ios 0x00111649 -[MMProgressHUD showWithTitle:status:confirmationMessage:cancelBlock:images:] + 617 12 selfpay-ios 0x00110429 +[MMProgressHUD(Class) showWithTitle:status:confirmationMessage:cancelBlock:images:] + 809 13 selfpay-ios 0x0010fcf6 +[MMProgressHUD(Class) showWithTitle:status:cancelBlock:images:] + 246 14 selfpay-ios 0x0010f6cd +[MMProgressHUD(Class) showWithTitle:status:] + 157 15 selfpay-ios 0x00056746 -[DRAAppDelegate applicationDidBecomeActive:] + 182 16 UIKit 0x01c5db04 -[UIApplication _stopDeactivatingForReason:] + 329 17 UIKit 0x01c631e2 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 1378 18 UIKit 0x01c7742c -[UIApplication handleEvent:withNewEvent:] + 3447 19 UIKit 0x01c77999 -[UIApplication sendEvent:] + 85 20 UIKit 0x01c64c35 _UIApplicationHandleEvent + 736 21 GraphicsServices 0x0470d2eb _PurpleEventCallback + 776 22 GraphicsServices 0x0470cdf6 PurpleEventCallback + 46 23 CoreFoundation 0x03197dd5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 53 24 CoreFoundation 0x03197b0b CFRunLoopDoSource1 + 523 25 CoreFoundation 0x031c27ec CFRunLoopRun + 2156 26 CoreFoundation 0x031c1b33 CFRunLoopRunSpecific + 467 27 CoreFoundation 0x031c194b CFRunLoopRunInMode + 123 28 UIKit 0x01c626ed -[UIApplication _run] + 840 29 UIKit 0x01c6494b UIApplicationMain + 1225 30 selfpay-ios 0x0002010d main + 141 31 libdyld.dylib 0x0378b725 start + 0

larsacus commented 11 years ago

Yeah this was interesting. It appears to have been some kind of a cleanup sync issue.

Try some of the stuff i've been working on in the view-controller-fix branch.

mathewaj commented 11 years ago

I'm also having this issue. Is it possible to access this new branch using Cocoapods or would I have to install manually?

roamerxv commented 11 years ago

I'm also having this errors. I'm using 1.xcode 5 2.sdk 7.0

  1. architectures is " armv7 , armv7s " , not " armv7 , armv7s , arm64" 4.not use ARC . I'm set "-fobjc-arc " flag to compile source MMHud.m

When 2nd run "[MMProgressHUD showWithTitle:@"attend" status:@"begin"];"

I got the error track:

2013-10-13 23:19:22.458 ILiveTraffic[8840:a0b] * Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! View <MMProgressHUD: 0xcb98070; frame = (0 0; 320 480); autoresize = W+H; gestureRecognizers = <NSArray: 0x19792670>; layer = <CALayer: 0xcb875d0>> is associated with <MMProgressHUDViewController: 0x19791a90>. Clear this association before associating this view with <MMProgressHUDViewController: 0xc90f850>.' * First throw call stack: ( 0 CoreFoundation 0x03fd25e4 exceptionPreprocess + 180 1 libobjc.A.dylib 0x044d58b6 objc_exception_throw + 44 2 CoreFoundation 0x03fd23bb +[NSException raise:format:] + 139 3 UIKit 0x02f42809 -[UIView(Internal) _setViewDelegate:] + 242 4 UIKit 0x02ff455c +[UIViewController setViewController:forView:] + 40 5 UIKit 0x02feefb1 -[UIViewController setView:] + 511 6 ILiveTraffic 0x00032d47 -[MMProgressHUDViewController setView:] + 87 7 ILiveTraffic 0x0003da79 -[MMProgressHUD _buildHUDWindow] + 233 8 ILiveTraffic 0x0003dd88 -[MMProgressHUD _buildHUD] + 152 9 ILiveTraffic 0x0003eb9f -[MMProgressHUD show] + 559 10 ILiveTraffic 0x0003c67d -[MMProgressHUD showWithTitle:status:confirmationMessage:cancelBlock:progressStyle:] + 541 11 ILiveTraffic 0x0003c457 -[MMProgressHUD showWithTitle:status:confirmationMessage:cancelBlock:images:] + 439 12 ILiveTraffic 0x000322a5 +[MMProgressHUD(Class) showWithTitle:status:confirmationMessage:cancelBlock:images:] + 373 13 ILiveTraffic 0x00031f93 +[MMProgressHUD(Class) showWithTitle:status:cancelBlock:images:] + 131 14 ILiveTraffic 0x00031ca5 +[MMProgressHUD(Class) showWithTitle:status:] + 101 15 ILiveTraffic 0x00016ba0 -[iLiveTrafficMapViewController locateError:] + 384 16 ILiveTraffic 0x000169b2 -[iLiveTrafficMapViewController locationManager:didFailWithError:] + 66 17 CoreLocation 0x01be0c8c CLLocationCoordinate2DGetDistanceFrom + 18884 18 CoreLocation 0x01be00ce CLLocationCoordinate2DGetDistanceFrom + 15878 19 CoreLocation 0x01bdd43c CLLocationCoordinate2DGetDistanceFrom + 4468 20 CoreLocation 0x01bd6be0 CLClientInvalidate + 996 21 CoreFoundation 0x03f91230 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK + 16 22 CoreFoundation 0x03f5a469 CFRunLoopDoBlocks + 361 23 CoreFoundation 0x03f788b3 CFRunLoopRun + 2355 24 CoreFoundation 0x03f77b33 CFRunLoopRunSpecific + 467 25 CoreFoundation 0x03f7794b CFRunLoopRunInMode + 123 26 GraphicsServices 0x049939d7 GSEventRunModal + 192 27 GraphicsServices 0x049937fe GSEventRun + 104 28 UIKit 0x02edb94b UIApplicationMain + 1225 29 ILiveTraffic 0x0004ff2d main + 125 30 libdyld.dylib 0x0524b725 start + 0 ) libc++abi.dylib: terminating with uncaught exception of type NSException

larsacus commented 11 years ago

You can use the branch with cocoapods by specifying the following in your Podfile: pod 'LARSAdController', :git => '<repo_url>', :branch=>'<branch_name>'

Note that this is not production-ready yet as is not an official release. Don't ship that Podfile entry to the App Store.

mathewaj commented 11 years ago

Thanks Lars. Would you say we're talking weeks or months till the next official release?

On 13 October 2013 17:50, Lars Anderson notifications@github.com wrote:

You can use the branch with cocoapods by specifying the following in your Podfile: pod 'LARSAdController', :git => '', :branch=>''

Note that this is not production-ready yet as is not an official release. Don't ship that Podfile entry to the App Store.

— Reply to this email directly or view it on GitHubhttps://github.com/mutualmobile/MMProgressHUD/issues/6#issuecomment-26221483 .

larsacus commented 11 years ago

The more people that use the new code and tell me it works and doesn't break anything, the faster it will be.

roamerxv commented 11 years ago

HI。 larsacus .

Thank you very much . I use this code int Podfile:

platform :ios , '6.0' pod 'MMProgressHUD', :git => 'https://github.com/mutualmobile/MMProgressHUD.git', :branch=>'view-controller-fix'

It's running good.

larsacus commented 11 years ago

Marking this as resolved with the latest commits in master.

LucasVidal commented 10 years ago

Hello,

I'm currently receiving several crash reports from users experiencing the same issue (identical stacktrace & exception thrown), but I'm unable to reproduce it locally.

Which was the commit that fixed this issue? I would like to see it in order to check if it is fixed or may be leaking somewhere else...

Thanks!

[Using Pods version 0.2.1]

larsacus commented 10 years ago

I believe the fix in the branch referenced above was in commit 853644ae5c90a333cde34620f1e1ac5775502b26.