【问题标题】:Warning after posting text on twitter wall在推特墙上发布文字后发出警告
【发布时间】:2013-08-04 12:46:06
【问题描述】:

我收到警告, 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. 在推特墙上发布文字后

hear 是显示此警告后的代码

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 我收到要在 Twitter 墙上发布的消息

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

【问题讨论】:

  • 您可以在 NSString 中分配此文本,因为它将在后台线程中运行,因此会显示警告。
  • @Divz 是的,它工作正常.. 谢谢 :)
  • 欢迎 :) 享受编码

标签: iphone ios ipad twitter


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-22
    • 1970-01-01
    • 1970-01-01
    • 2017-06-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多