JGProgressHUD icon indicating copy to clipboard operation
JGProgressHUD copied to clipboard

[UIView initWithFrame:] must be used from main thread only

Open leonhsieh opened this issue 1 year ago • 1 comments

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];

leonhsieh avatar Oct 18 '23 01:10 leonhsieh

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.

JonasGessner avatar Oct 18 '23 01:10 JonasGessner