【发布时间】: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 是的,它工作正常.. 谢谢 :)
-
欢迎 :) 享受编码