Abhinav
Abhinav

Reputation: 38162

Initializing UITextView in a thread -- Causing issue

When I am trying to execute in a thread:

UITextView *aDescriptionView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 25, 50)];

I am getting this error:

bool _WebTryThreadLock(bool), 0x2819b0: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now...

What went wrong here? What should I do? I have to have this in a separate thread as it returns me a UIView object.

Upvotes: 2

Views: 566

Answers (1)

seppo0010
seppo0010

Reputation: 15859

You must not access UI from any thread besides the main thread. Ever.

Upvotes: 5

Related Questions