在线程中初始化UITextView - 导致问题

Abh*_*nav 2 iphone cocoa-touch uitextview nsthread

当我尝试在线程中执行时:

UITextView *aDescriptionView = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 25, 50)];
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

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...
Run Code Online (Sandbox Code Playgroud)

这里出了什么问题?我该怎么办?我必须在一个单独的线程中有这个,因为它返回一个UIView对象.

sep*_*010 5

除主线程外,您不能从任何线程访问UI.永远.