0

Obtaining the web lock from a thread other than the main thread or the web thread. UIKit should not be called from a secondary thread. 在推特墙上发布文字后,我收到了警告

听到是显示此警告后的代码

ACAccount *acct = [arrayOfAccounts objectAtIndex:0];
 TWRequest *postRequest = [[TWRequest alloc] initWithURL: [NSURL  URLWithString:@"http://api.twitter.com/1/statuses/update.json"] parameters:[NSDictionary dictionaryWithObject:_textView.text 
                                              forKey:@"status"] requestMethod:TWRequestMethodPOST];


听到 _textView.text 我收到要在推特墙上发布的消息

为什么我收到此警告以及如何摆脱它。

4

1 回答 1

0

您没有显示足够的代码,但您的请求的响应可能会在后台线程上返回,并且您正在直接尝试更新 UI。你不能那样做。收到响应后并在更新 UI 之前,您需要切换回主线程。

于 2013-08-03T08:35:06.503 回答