JGProgressHUD
JGProgressHUD copied to clipboard
[UIView initWithFrame:] must be used from main thread only
Hi there, I have encounter a thread issue when using indicatorView of JGProgressHUD:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.'
And a thread warning -[UIView initWithFrame:] must be used from main thread only appears on this line:
self = [super initWithFrame:CGRectZero];
This is caused by calling JGProgressHUD
methods on a background thread. JGProgressHUD
is a UI element, inheriting from UIView
and all UIView
methods have to be called from the main thread.
So make sure that all your code that interacts with the hud is executed on the main thread.