gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 20:34:43 25 4
gpt4 key购买 nike

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

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

我收到此错误:

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...

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

最佳答案

您不得从主线程之外的任何线程访问 UI。曾经。

关于iphone - 在线程中初始化 UITextView ——导致问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4834537/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com