dispatch_async内で、UITextViewのtextプロパティーにアクセスしたら下のような警告が出力された。
void _WebThreadLockFromAnyThread(bool), 0x8547fb0: 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. |
dispatch_async(main_queue, ^{ });の中だとおkなんだけど、
dispatch_async(dispatch_queue_create("hoge", NULL);, ^{ });の中だとNG.
だから、メインスレッド以外のスレッドでUITextViewのtextプロパティを使いたい場合は、
NSString *foo = uiTextView.text; dispatch_async(dispatch_queue_create("hoge", NULL);, ^{ //fooを使った処理 });って書けばいいんですな。
0 コメント:
コメントを投稿